Lorenz Meyer
Lorenz Meyer

Reputation: 19945

Composer, why do I have multiple subdirectories?

I'm new to composer. I've installed one package with several dependecies. I get a strange directory structure inside the vendor folder:

/vendor
    /symphony
        /event-dispatcher
            /Symphony
                /Component
                    /EventDispatcher
        /http-foundation
            /Symphony
                /Component
                    /HttpFoundation
        /...
            /Symphony
                /Component

I would expect to have all symphony components in one folder /Symphony/Component, but instead of this, I have as many /Symphony/Component as I have symphony components.

I have a very basic composer.json file:

{
    "autoload": {
        "psr-0": {
            "Mb\\": "inc/"
        }
    },
    "require": {
        "cboden/Ratchet": "0.3.*",
        "react/zmq": "0.2.*"
    }
}

Is this the normal behavior, or did I do something wrong ?

Upvotes: 1

Views: 167

Answers (1)

Justin Howard
Justin Howard

Reputation: 5643

This directory structure is normal. The cboden/ratchet package requires the symfony/http-foundation and symfony/routing packages. Those in turn have additional dev dependencies including more Symfony packages. Composer installs each composer package independently into its own directory in vendor. The package source code is inside each one of those. Because all the Symfony packages use the same root namespace, you end up with a lot of packages with similar directory structures. This is how composer is designed.

Upvotes: 1

Related Questions