Base Plugin Class
Every plugin should extends from this class or implement the interfaces and include a plugin class in it's src root folder.
string[]
['routes', 'bootstrap', 'console', 'middleware']
bool
Do bootstrapping or not
string
The class path for this plugin.
string
The config path for this plugin.
bool
Console middleware
bool
Enable middleware
string
The name of this plugin
string
The path to this plugin.
bool
Load routes or not
string
The templates path for this plugin.
__construct(array $options)
Constructor
array
$options optional Options
bootstrap(\Cake\Core\PluginApplicationInterface $app)
Load all the application configuration and bootstrap logic.
The default implementation of this method will include the config/bootstrap.php
in the plugin if it exist. You can override this method to replace that behavior.
The host application is provided as an argument. This allows you to load additional plugin dependencies, or attach events.
\Cake\Core\PluginApplicationInterface
$app The host application
checkHook(string $hook)
Check if a hook name is valid
string
$hook The hook name to check
InvalidArgumentException
console(\Cake\Console\CommandCollection $commands)
Add console commands for the plugin.
\Cake\Console\CommandCollection
$commands The command collection to update
\Cake\Console\CommandCollection
disable(string $hook)
Disables the named hook
string
$hook The hook to disable
$this
enable(string $hook)
Enables the named hook
string
$hook The hook to disable
$this
getClassPath()
Get the filesystem path to configuration for this plugin
string
getConfigPath()
Get the filesystem path to configuration for this plugin
string
getName()
Get the name of this plugin.
string
getPath()
Get the filesystem path to this plugin
string
getTemplatePath()
Get the filesystem path to templates for this plugin
string
initialize()
Initialization hook called from constructor.
isEnabled(string $hook)
Check if the named hook is enabled
string
$hook The hook to check
bool
middleware(\Cake\Http\MiddlewareQueue $middlewareQueue)
Add middleware for the plugin.
\Cake\Http\MiddlewareQueue
$middlewareQueue The middleware queue to update.
\Cake\Http\MiddlewareQueue
routes(\Cake\Routing\RouteBuilder $routes)
Add routes for the plugin.
The default implementation of this method will include the config/routes.php
in the plugin if it exists. You can override this method to replace that behavior.
\Cake\Routing\RouteBuilder
$routes The route builder to update.
Do bootstrapping or not
bool
The class path for this plugin.
string
The config path for this plugin.
string
Console middleware
bool
Enable middleware
bool
The name of this plugin
string
The path to this plugin.
string
Load routes or not
bool
The templates path for this plugin.
string
© 2005–present The Cake Software Foundation, Inc.
Licensed under the MIT License.
CakePHP is a registered trademark of Cake Software Foundation, Inc.
We are not endorsed by or affiliated with CakePHP.
https://api.cakephp.org/4.1/class-Cake.Core.BasePlugin.html