composer/composer — Issue #73: Autoloader cannot work as is
Author: fabpot
Created: 2011-10-30 09:13:09+00:00
State: open

I wanted to add some autoload configuration for my projects but it's not possible yet.

All packages are installed under a directory derived from the package name (`symfony/console`, `symfony/symfony`, ...). This provides a good isolation between different packages, but that's not enough. For "whole" libraries like Symfony or Monolog, it works fine because where the directory structure is the same as the namespace one. But for Symfony components or Symfony bundles, that's not the case.

For instance, `Symfony\Components\Console` is under `vendor/symfony/console/`. So, a PSR-0 autoloader won't be able to handle this case. What about adding a `base_path` configuration in the `composer.json` file? That way, we can instruct Composer to install the files under `vendor/symfony/console/Symfony/Component/Console`.

Note that this will solve the bundle issue as we won't have to manage it differently than any other library. One downside is that the same namespace can be found under more than one directory, which means that you need an autoloader that is able to handle this case.

Another possibility could consist of the creation of symlinks but I can see many problems: Windows support, possible confusion if you install the `symfony/symfony` package and the `symfony/console` one for instance.