1
votes

I'm having some issues installing and configuring a plugin, and I think if I had a better idea of how things worked I might be able to figure it out?!

When I install the cakemanager/cakephp-settings plugin via composer it adds to my vendor folder a 'cakemanager' folder with 3 sub-folders: 'cakephp-settings', 'cakephp-utils' (a dependency) and 'Settings'. The 'cakephp-settings' folder is essentially empty, and all the plugin files are in the 'Settings' folder.

However, when I try to run the migrations I get an error that it cant find the /vendor/cakemanager/cakephp-settings/config/bootstrap.php file - no small wonder as this file doesnt exist! Same error pretty much everywhere in my application

In the vendor/cakephp-plugins.php file I have this:

'Settings' => $baseDir . '/vendor/cakemanager/cakephp-settings/',

If I temporarily change this to

'Settings' => $baseDir . '/vendor/cakemanager/Settings/',

I can get the migrations done and my pages look normal again, however this reverts when I run composer dumpautoload and causes further issues down the track - I need a permanent solution.

How do I edit the plugin (composer.json files?) so that it builds the cakephp-plugins.php file correctly and it looks in the correct path for the bootstrap.php file?

1
Do you have composer/installers installed by any chance? - ndm
Yes, and the plugin composer.json has the following in it as well, which I believe relates to composer/installers from reading the readme.md? - "extra": { "installer-name": "Settings" }, - Sanfly
Correct, and that's where the problem stems from. - ndm

1 Answers

0
votes

I would suggest that you try to push merging this pull request, as that will fix the problem at its root, the installer-name option in the plugins composer.json will cause the target folder to be named "incorrectly" in case composer/installers is installed.

There is no reason to change the folder name, and as of Version 3, CakePHP doesn't need composer/installers anymore, so removing the option should fix the problem.

You could also try to remove composer/installers if you don't actually need it. In case that isn't possible, you should also be able to work around the problem by specifying the actual path via the Plugin::load() calls path option:

Plugin::load('Settings', [
    'path' => ROOT . DS . 'vendor' . DS . 'cakemanager' . DS . 'Settings'
]);

It may also be worth reporting the problem to https://github.com/cakephp/plugin-installer and/or https://github.com/composer/installers, maybe it's possible to get them working together with respect to the installer-name option.

See also