According to the project’s github, this is the correct installation path via Poser.
Because this plugin has the type cakephp-plugin set in it’s Own Composer.json, Composer Knows 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 configuration type: cakephp-plugin
, what is true looking at the project repository.
According to the Composer documentation, this really is the behavior of this configuration.
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 a user runs php Composer.phar install.
I believe Cakephp should work that way, although I’ve never used it.
According to Cakephp documentation
Autoloading Plugin Classes
When using Bake for Creating a plugin or when Installing a plugin using Composer, you don’t 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 a fallback >autoloading for your plugin:
Plugin::load('ContactManager', ['autoload' => true]);
If you really need to change the path from where Composer installs Cakephp plugins, just add the following configuration to your Composer.json file
A 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"]
}
}
}
That’s the last part I wanted. Thank you!
– Leonel Sanches da Silva
It just doesn’t make much sense You have to do this for a cakephp plugin itself but blz.
– Édipo Costa Rebouças
@Édipo Costa Rebouças how to install Composer. I tried searching the internet and doing it in git bass, but I couldn’t.
– André Nascimento
https://getcomposer.org/doc/00-intro.md items 3 and 4
– Édipo Costa Rebouças