I recently started building an application locally using CakePHP 4.X. I installed Composer and used it to successfully install the CakePHP authentication and authorization plugin. Now I'm trying to move to some community developed plugins like
I can install all the plugins, but when I try to load the plugins I have a problem. Following the instructions on each plugin's Git page, I tried loading the plugin from the CLI using the following lines
bin\cake plugin load BootstrapUI
(I'm using Windows so I use backslashes)
In all cases I receive the following message:
Your Application class does not have a bootstrap() method. Please add one.
My src/Application.php file looks like this
class Application extends BaseApplication public function bootstrap() : void { // Call the parent to `require_once` config/bootstrap.php parent::bootstrap(); if (PHP_SAPI === 'cli') { $this->bootstrapCli(); } else { FactoryLocator::add( 'Table', (new TableLocator())->allowFallbackClass(false) ); } /* * Only try to load DebugKit in development mode * Debug Kit should not be installed on a production system */ if (Configure::read('debug')) { $this->addPlugin('DebugKit'); } // Load more plugins here $this->addPlugin('Authorization'); $this->addPlugin('Authentication'); $this->addPlugin('BootstrapUI'); }
Your application class is missing
{
after theclass Application extends BaseApplication
, but I guess it was pasted/edited incorrectly here.Your command seems to work as I see the plugin
$this->addPlugin('BootstrapUI')
has been added to the file.When executing CLI commands, make sure you are at the correct path (in the root directory of your application):
You can add plugins manually in bootstrap() method without CLI.