Google Groups

Re: [composer-dev] Re: autoload overriding

Marco Pivetta Sep 11, 2012 7:10 AM
Posted in group: composer-dev
As I've said above, since PSR-0 autoloading doesn't "guarantee" any order in which autoloading will happen, you will be affected by eventual future changes in autoloading strategies if you keep using this method. It is not safe -> not an option at all.

Marco Pivetta    

On 11 September 2012 16:06, David Guyon <> wrote:
You're probably right on this one.

But the point is that this a core class used within a Silex Application. And I won't override every part of the standard code that make a construct call to my overriden class.

Another way out is to fork the component and defining it as a repository in my composer.json, but I must maintain a fork.
Basically, changing the order of directories assigned to as namespace is still the best option IMO.

On Tuesday, September 11, 2012 3:52:32 PM UTC+2, David Guyon wrote:
Hi there,

I have overridden a specific class of the Symfony Routing Component within my src directory.
How can I tell Composer to autoload this namespace from my src dir before the vendor dir ?

I used to have :

'Symfony\\Component\\Routing' => array($baseDir . '/src', $vendorDir . '/symfony/routing/'),

And now :

'Symfony\\Component\\Routing' => array($vendorDir . '/symfony/routing/', $baseDir . '/src'),

Here is my composer.json autoload definition :
    "autoload": {
        "psr-0": {
            "MyCompany": "src/",
            "Symfony\\Component\\Routing": "src"

Thanks for advices and tips !

You received this message because you are subscribed to the "composer-dev" group.
To post to this group, send email to
To unsubscribe from this group, send email to
For more options, visit this group at