|Component:||Base system (internal API)|
We need a PSR-0 class auto-loader for Drush so that we can simplify the bootstrap process as all code would be autoloaded when needed.
- Bring in Composer to generate an autoload.php file for us
- Use Composer's dependency system to install any third-party libraries (HTTPServer, Console_Table, etc)
- Have Drush instantiate a Composer installation on first-run
Follow up tasks
Once the patch is committed, we can...
- Simplify the bootstrap by moving files over to PSR-0 autoloading classes
- Have any new Drush dependencies download automatically for us without us having to micro-manage them
- Instead of including Composer directly, have Drush download it for us?
- Possibly switch from using Composer's Phar file to the source directly?
- Introduce a "drush composer" command to allow further use of Composer via Drush?
User interface changes
- When running Drush for the first time, the user is told that the dependencies are being installed. This is a one-time process and the user won't be prompted about it again.
- There is a new command named
drush composer, which allows direct use of Composer.
drush_bootstrap_prepare_dependencies()is called during the bootstrap to make sure all of Drush's dependencies are met. It then loads the class loader to make sure all classes can be autoloaded.
- Drush's PSR-0 classes can be placed in
Original report by msonnabaum
Here's an initial patch to add a PSR-0 autoloader to drush, which is based on symfony's.
To test it I've only moved over the cache classes, but that appears to be working for me. This also removes php 5.2 support.