According to the github of the project, this is the correct way of installing via composer.
Because this plugin has the type cakephp-plugin set in it's own composer.json, composer knows how to install it inside your / plugins directory, rather than in the usual vendors file. It is recommended that you add / Plugins / Upload to your .gitignore file.
The project documentation says that the plugin has a composer file with the type: cakephp-plugin
setting, which is true of looking at the project repository.
According to the composer documentation , this is really the behavior of this setup.
This is an example for a CakePHP plugin. The only important parts to set in your composer.json file are "type": "cakephp-plugin" which describes what your package is and "require": {"composer / installers": "~ 1.0"} which tells composer to load the custom installers.
{
"name": "you/ftp",
"type": "cakephp-plugin",
"require": {
"composer/installers": "~1.0"
}
}
This would install your package to the Plugin / Ftp / folder of a CakePHP app when using php composer.phar.
I think CakePHP should work that way, though I've never used it.
According to the CakePHP documentation
Autoloading Plugin Classes
When using bake for creating a plugin or when installing a plugin using Composer, you do not typically need to make any changes to your application in order to make CakePHP recognize the classes that live inside it.
In any other cases you may need to modify your application's composer.json file to contain the following information:
"psr-4": {
(...)
"MyPlugin\": "./plugins/MyPlugin/src",
"MyPlugin\Test\": "./plugins/MyPlugin/tests"
}
Additionally you will need to tell Composer to refresh its autoloading cache:
$ php composer.phar dumpautoload
If you are unable to use Composer for any reason, you can also use fallback> autoloading for your plugin:
Plugin::load('ContactManager', ['autoload' => true]);
If you really need to change the path where the composer installs the CakePHP plugins, you would just add the following configuration to your composer.json file
The package type can have a custom installation path with a type: prefix.
{
"extra": {
"installer-paths": {
"your/custom/path/{$name}/": ["type:cakephp-plugin"]
}
}
}
Or you can change the installation path of a single package
If you are consuming a package that uses the composer / installers you can override the install path with the following extra in your composer.json:
{
"extra": {
"installer-paths": {
"your/custom/path/{$name}/": ["shama/ftp", "vendor/package"]
}
}
}