Plugin Shell

The plugin shell allows you to load and unload plugins via the command prompt.If you need help, run:

  1. bin/cake plugin --help

Loading Plugins

Via the Load task you are able to load plugins in yourconfig/bootstrap.php. You can do this by running:

  1. bin/cake plugin load MyPlugin

This will add the following to your src/Application.php:

  1. // In the bootstrap method add:
  2. $this->addPlugin('MyPlugin');
  3.  
  4. // Prior to 3.6, add the following to config/bootstrap.php
  5. Plugin::load('MyPlugin');

If you are loading a plugin that only provides CLI tools - like bake - you canupdate your bootstrap_cli.php with:

  1. bin/cake plugin load --cli MyPlugin
  2. bin/cake plugin unload --cli MyPlugin

New in version 3.4.0: As of 3.4.0 the —cli option is supported

Unloading Plugins

You can unload a plugin by specifying its name:

  1. bin/cake plugin unload MyPlugin

This will remove the line $this->addPlugin('MyPlugin',…) fromsrc/Application.php.

Plugin Assets

CakePHP by default serves plugins assets using the AssetMiddleware middleware.While this is a good convenience, it is recommended to symlink / copythe plugin assets under app’s webroot so that they can be directly served by theweb server without invoking PHP. You can do this by running:

  1. bin/cake plugin assets symlink

Running the above command will symlink all plugins assets under app’s webroot.On Windows, which doesn’t support symlinks, the assets will be copied inrespective folders instead of being symlinked.

You can symlink assets of one particular plugin by specifying its name:

  1. bin/cake plugin assets symlink MyPlugin