Monday, January 31, 2022

[FIXED] Putting composer.json in the root of a CakePHP installation

Issue

My current website installation looks like this:

.htaccess app/composer.phar app/composer.json app/Config app/Controller app/Model app/Plugin app/Test app/tmp app/Vendor (CakePHP and most other composer packages get installed here) app/webroot

I would quite like the composer files to be in the root of the structure. I know I can change vendor-dir in composer.json to app/Vendor however the issue I am having is that some of my required packages are of the cakephp-plugin so they automatically get installed to the Plugin folder - this is working fine for the above folder structure. But if I move composer.json to the root, I am unsure how to make them go to app/Plugin without defining the path for each package in composer.json to override where composer would want to install to. What is the correct way to do this?


Solution

It looks like you just need to add this to your composer.json. I haven't tested it.

{
    "extra": {
        "installer-paths": {
            "app/Plugin/{$name}/": ["type:cakephp-plugin"]
        }
    }
}

More info: https://github.com/composer/installers#custom-install-paths



Answered By - kevinsearle

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.