Question

I have a web application that I built using FuelPHP which is hosted on a private GitHub repo.

I recently added JAXL and APNS-PHP to the project using Composer. Specifically, I created a composer.json inside of the fuel/app directory with these contents:

{
    "require": {
        "varavan/apns-php": "dev-master",
        "abhinavsingh/jaxl": "3.*@dev"
    }
}

I ran composer update and everything works fine on my local development environment. I can push to GitHub just fine from the command line also.

However, when I pull on the public server, the newly installed composer packages are not included in the pull, although their directories are created. Specifically, these directories exist, but are empty:

fuel/app/vendor/abhinavsingh/jaxl/
fuel/app/vendor/varavan/apns-php/

If I look at those directories on GitHub, they don't look like directories. They've got an icon that I don't recognize:

This is what the directories look like on GitHub

Also, if I click on "Sync Branch" from the GitHub GUI app, it gives me this message This has been resolved, see update below.

The submodule at 'fuel/app/vendor/abhinavsingh/jaxl' was removed from .gitmodules, but the folder still exists in the repositroy. Delete the folder, commit the change, then try again.

WHAT!?

I used composer to install JAXL, not Git.

If I run composer install on the server, it says:

Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Nothing to install or update
Generating autoload files

But the JAXL and APNS-PHP directories are still empty.

How do I get the composer packages onto my production server?

Update

I added this to my .gitmodules file:

[submodule "fuel/app/vendor/abhinavsingh/jaxl"]
        path = fuel/app/vendor/abhinavsingh/jaxl
        url = git://github.com/abhinavsingh/JAXL.git
[submodule "fuel/app/vendor/varavan/apns-php"]
        path = fuel/app/vendor/varavan/apns-php
        url = git://github.com/varavan/ApnsPHP.git

That fixed the error that the GitHub GUI app was giving me, but I still can't figure out how to get the composer packages installed on the production server.

Was it helpful?

Solution

I continued to try everything I could think of to get the composer packages loaded, but I couldn't figure it out.

After adding the submodule definitions to my .gitmodules file, I deleted the entire project from the production server and re-cloned the whole thing from GitHub. The submodules came along for the ride.

It's not the composer way of doing things...

Whatever. What a waste of time.

OTHER TIPS

Composer uses git, especially if you specify you want a development version. It will get it directly from the source.

And if you create a second vendor folder inside app, and Composer has added a git repository there (because of what you specified), git will detect a repo-in-repo, and since submodules are active for Fuel, it will assume you're adding a new submodule.

Like Martin Bean said, make sure you exclude the vendor folder, to prevent this from happening.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top