Mainone
Mainone

Reputation: 108

How to install different types of composer packages in different directories?

I know that you can change the vendor directory by using

    "config": {
        "vendor-dir": "customdir"
    }

But this changes the directory for all packages. How can I change the directory for custom composer types?

Upvotes: 1

Views: 194

Answers (1)

Laurens
Laurens

Reputation: 2607

You can use this composer package: Composer Custom Type Installer. Any custom type can be used to define a path the type should be installed in.

Got this example from the github about how to use it:

{
    "extra": {
        "custom-installer": {
            "web/": ["type:drupal-core"],
            "web/sites/{$name}/": ["type:drupal-site"],
            "custom/{$type}/{$vendor}/{$name}/": ["type:random-type"],
            "vendor/{$vendor}/{$name}/": ["type:library"],
            "web/sites/all/libraries/{$name}/": [
                "type:component",
                "ckeditor/ckeditor",
                "flesler/jquery.scrollto"
            ],
            "custom-folder-for-single-package": ["myvendorname/single-package"],
        }
    }
}

Upvotes: 1

Related Questions