Attempting to install Cakephp-Upload plugin (Cake v5.0.8)

I would’ve thought this was going to be easy. Following the instructions from the CakePHP Upload Documentation page, from my project’s base directory, I ran:

composer require josegonzalez/cakephp-upload

This worked without errors. The files loaded into my /vendor/ folder at josegonzalez/cakephp-upload. When trying to run the next command, I’ve not been successful. I have tried different variations in case there was a change from CakePHP v4 to v5 on plugin naming expectations (though according to the v8.0.0 release of this plugin, it is CakePHP v5 compatible).

The friendsofcake/search plugin, just above this one in the filepath, installed as expected. I could try to manually modify the /vendor/cakephp-plugins.php file, and /config/plugins.php (and maybe Application.php?), but was not sure why it’s failing, and what the console’s load plugin command actually does. (I tried to check source and follow it but failed.)

Does anyone have any thoughts?

I am on latest CakePHP 5.3 and bin/cake plugin load Josegonzalez/Upload works fine for me

In my case it adjusted the contents of the config/plugins.php to add

'Josegonzalez/Upload'

but you can also add that plugin in your src/Application.php bootstrap method via

$this->addPlugin('Josegonzalez/Upload');

or

$this->addPlugin(\Josegonzalez\Upload\UploadPlugin::class);

And as you properly deducted the string name of that plugin can be checked in your vendor/cakephp-plugins.php File if you don’t know it or the docs are not clear

In your case I think the bin/cake plugin load command may have had a bug. Which version of CakePHP are you using exaclty?

You can check that via bin/cake version

1 Like

Oh dang, that was all that the console command does? I thought it might’ve moved things around in the filesystem and was hesitant to manually hardcode paths if it wasn’t yet “ready”. Apologies. I had read in the manual that plugins can be added manually by the examples you had provided; but if it was so easy, the use of a console command made me think there was more going on. :person_facepalming:

I meant to include the exact CakePHP version too - that was my mistake. v5.0.8.

Thank you, Kevin!