0

I've added through Composer the php aws-sdk to my app. It also downloaded - as dependencies of aws-sdk - two modules: Guzzle and the Symfony event-dispatcher.

When I committed and pushed my changes to my repo, the only module added was the aws-sdk, the other 2 modules are "Untracked files".

How can I add the modules to the repository?

If I push to aws right now, the modules are not added, am I right? Another developer synced my changes and in its local the app is broken - because of the two required modules...

Thanks.

peppeocchi
  • 814
  • 1
  • 9
  • 22
  • Are you versioning your `vendor/` folder? Generally you would ignore this and only commit the `composer.json` and `composer.lock` files. Then other developers can `composer install` to install libraries and their dependencies. – ChrisGPT was on strike Jan 07 '15 at 17:33
  • References: https://getcomposer.org/doc/faqs/should-i-commit-the-dependencies-in-my-vendor-directory.md https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file – ChrisGPT was on strike Jan 07 '15 at 17:38
  • Yes, I understand why are not copied to the repo. I push to elastic beanstalk with `git aws.push` that, I think, pull from eb the current branch. If the current branch doesn't have those folders: - how can I run composer install? - the app will not work until I run composer install? . How can I push the app to eb without having the app broken until I run composer install? There is some workaround? Thanks! – peppeocchi Jan 07 '15 at 18:00
  • 1
    Elastic Beanstalk [supports Composer out of the box](http://aws.amazon.com/about-aws/whats-new/2012/12/18/aws-elastic-beanstalk-support-for-environment-resources-and-an-updated-php-runtime/). I can't find a good resource for how it works, but I think if you put your `composer.json` and `composer.lock` files in the root of your repository EB will automatically install your dependencies. See also http://stackoverflow.com/questions/17521843/aws-elastic-beanstalk-and-composer – ChrisGPT was on strike Jan 07 '15 at 18:08
  • Ok I just tried, but looks like the nested modules are not installed (aws-sdk is there but not it's dependencies - guzzle and the event-dispatcher). In my composer.json I require only aws-sdk - in the composer.json of aws-sdk are required the above dependencies. Do I need to add in my composer.json guzzle and event-dispatcher? Or I just need to remove the vendor folder from my repo and let eb install it? Thanks again. – peppeocchi Jan 08 '15 at 09:10
  • Awesome, just removed the vendor folder from my repo, added to gitignore, pushed to eb and everything is working now! Thanks for your help! – peppeocchi Jan 08 '15 at 09:29
  • Glad it worked! I've added this as a proper answer. – ChrisGPT was on strike Jan 08 '15 at 12:49

1 Answers1

0

Composer recommends versioning your composer.json and composer.lock files but not your vendor/ directory, which Composer itself creates and manages through the composer install and composer update commands.

Elastic Beanstalk builds your application for you, including installing its dependencies, when you deploy. This is true of most of its competitors as well.

Since December, 2012 EB has supported Composer out of the box. Unfortunately, there doesn't seem to be much documentation on how this works, but other PaaS providers generally read dependency files from the root of your repository.

The OP confirmed in comments above that having the composer.json and composer.lock files in the repository root and removing the vendor/ directory from version control caused the application to build correctly on EB.

ChrisGPT was on strike
  • 127,765
  • 105
  • 273
  • 257