5

Hi I am trying to setup a project using composer. I am able to install CakePHP but I am getting a hard time installing cakephp/debug_kit on a custom direcoty. I am trying to install it on "vendor/cakephp/cakephp/app/Plugin/DebugKit/" because CakePHP require its plugins to be installed on the Plugin directory of its "app" folder.

I already setup my composer.json according this site but still the plugin get installed on "vendor/cakephp/debug_kit"

Here is my composer.json maybe there is something wrong with my code. I am just a newbie in using composer.json.

 { "name" : "notmii/pse", "repositories" : [{ "type": "package", "package": { "name" : "cakephp/cakephp", "version" : "2.3.5", "source" : { "type" : "git", "url" : "git://github.com/cakephp/cakephp.git", "reference" : "2.3.5" }, "bin" : ["lib/Cake/Console/cake"] } }, { "type": "package", "package": { "name" : "cakephp/debug_kit", "version" : "2.2.0", "source" : { "type" : "git", "url" : "https://github.com/cakephp/debug_kit.git", "reference" : "2.2.0" } } }], "extra": { "installer-paths": { "vendor/cakephp/cakephp/app/Plugin/DebugKit/": ["cakephp/debug_kit"] } }, "require" : { "php": ">=5.3", "cakephp/cakephp" : ">=2.3.5", "cakephp/debug_kit": "2.2.*" } } 

4 Answers 4

11

Change your extra block to:

"extra": { "installer-paths": { "app/Plugin/DebugKit": ["cakephp/debug_kit"] } }, 

This worked for me.

Sign up to request clarification or add additional context in comments.

1 Comment

Note that in case of multiple matches, the first one found wins. For example, if you're developing a public Drupal module locally (I don't know anything about CakePHP), it will match type:drupal-module and go in web/modules/contrib by default. If you want it to go somewhere else, it needs to be declared first, like this: "web/someplace_special/{$name}":["drupal/my_custom_module"],"web/modules/contrib/{$name}":["type:drupal-module"] If you do the reverse, it will go in web/modules/contrib, even though it's a more precise match.
1

If you want to add all plugins to app/Plugin instead of defining custom path for each plugin, update your extra block like this:

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

Comments

0

Composer Packages Custom Installer plugin, you don't need to develop custom installer. Just FORK it and add your instructions in config directory under src/Installer CPCInstaller will do everything for you.

Comments

0

I would recommend to use oomphinc/composer-installers-extender project.

More about this project you can find on GitHub project page: https://github.com/oomphinc/composer-installers-extender

Here is my configuration for Moodle:

{ "name": "evolic/e-learning", "license": "MIT", "type": "project", "description": "e-Learning application", "repositories": [ { "type": "vcs", "url": "https://github.com/moodle/moodle.git" } ], "require": { "php": "^8.2", "ext-json": "*", "ext-zip": "*", "moodle/moodle": "v4.2.1", "composer/installers": "^2.2", "oomphinc/composer-installers-extender": "^2.0" }, "scripts": { "auto-scripts": { "create symlinks": "scripts/create-symlinks.sh" }, "post-install-cmd": [ "@auto-scripts" ], "post-update-cmd": [ "@auto-scripts" ] }, "extra": { "installer-types": ["project"], "installer-paths": { "public/": ["moodle/moodle"] } }, "config": { "allow-plugins": { "composer/installers": true, "oomphinc/composer-installers-extender": true } } } 

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.