I think Composer is a very nifty tool, and it would be nice to make use of it in as many areas of Drupal as possible.
The fact that it will be used in core 8.x as a tool to pull in Symfony is one step in the right direction, but I think modules can benefit from it too.
I would like to see this module include a composer.json to specify that it depends on aws-sdk-for-php. For the time being, users would then be able to install the Composer module and do "drush composer install" in this awssdk's directory.
I'm not sure where the aws-sdk-for-php code would end up in this case. Probably not in sites/all/libraries. This might be an issue if a user has two copies of aws-sdk-for-php installed.
In the long term, let's see what #1433256: Proposal: Composer as a Library Manager turns into.
Comments
Comment #1
boombatower commentedSo postponed then until this is viable?
Comment #2
seldaek commentedThis raises an interesting point. I never really thought of it that way. For such a large system as Drupal that may not be able to fully modify the plugin system to be a composer wrapper, adding *optional* support for composer.json inside modules so that modules can start to depend on external stuff easily would be a pretty cool first step.
Comment #3
boombatower commentedOne can already do this with drush make files, but the advantage composer has is that it is adopted outside of Drupal.
Comment #4
jbeckers commentedAs for the
This project https://github.com/shama/baton seems to be related, but does quite the opposite of what we want.
Comment #5
boombatower commentedAs of now trying to resolve the composer integration with drupal #1677524: Support composer/installers so that it puts library in the correct location.
Comment #6
boombatower commentedI created http://drupal.org/project/composer_autoload which is currently the best solution when using composer. I evaluated a lot of options and talked with folks like Rob Loach.
The primary issue is that composer cannot, currently, put the aws sdk from amazon in libraries directory, but instead places it inside the vendor directory of awssdk module. Using the autoload module the code from amazon will be available for autoload.
The integration provided by this module to allow configuration to be set through standard drupal variables would still be needed and would have to be placed in something like hook_init() or done away with entirely. Since libraries_load() will no longer be used we have no way to catch when the library is being used and inject our configuration at that point.
If someone wants to attempt this it should be quite straight forward although I am not sure I like the end result since the sdk is not placed in sites/.../libraries. Simply add a composer.json to awssdk module and include amazon sdk. Add a dependency on composer_autoload and then change the settings load to be in hook_init().
Comment #7
boombatower commentedLooks like this is going to be the best route: #542940: [meta] Support for downloading libraries via Composer.
Comment #8
cpliakas commentedI would urge you to check out Composer Manager as well. We manage some Drupal projects with a lot of dependencies that are required by multiple modules, and this is a really easy way to pull in requirements for all modules and manage them in a single library space.