On this page
Class BasePlugin
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.
- Cake\Core\BasePlugin implements Cake\Core\PluginInterface
Inherited Constants
Properties summary
- 
    $bootstrapEnabledprotectedDo bootstrapping or notboolean
- 
    $classPathprotectedThe class path for this plugin.string
- 
    $configPathprotectedThe config path for this plugin.string
- 
    $consoleEnabledprotectedConsole middlewareboolean
- 
    $middlewareEnabledprotectedEnable middlewareboolean
- 
    $nameprotectedThe name of this pluginstring
- 
    $pathprotectedThe path to this plugin.string
- 
    $routesEnabledprotectedLoad routes or notboolean
Method Summary
- 
    __construct() publicConstructor
- 
    bootstrap() publicLoad all the application configuration and bootstrap logic.
- 
    checkHook() protectedCheck if a hook name is valid
- 
    console() publicAdd console commands for the plugin.
- 
    disable() publicDisables the named hook
- 
    enable() publicEnables the named hook
- 
    getClassPath() publicGet the filesystem path to configuration for this plugin
- 
    getConfigPath() publicGet the filesystem path to configuration for this plugin
- 
    getName() publicGet the name of this plugin.
- 
    getPath() publicGet the filesystem path to this plugin
- 
    initialize() public
- 
    isEnabled() publicCheck if the named hook is enabled
- 
    middleware() publicAdd middleware for the plugin.
- 
    routes() publicAdd routes for the plugin.
Method Detail
__construct()source public
__construct( array $options = [] )Constructor
Parameters
- 
     array $optionsoptional []
- Options
bootstrap()source public
bootstrap( Cake\Core\PluginApplicationInterface $app )Load all the application configuration and bootstrap logic.
Parameters
- Cake\Core\PluginApplicationInterface- $app
- The host application
Implementation of
Cake\Core\PluginInterface::bootstrap()
  checkHook()source protected
checkHook( string $hook )Check if a hook name is valid
Parameters
- 
     string $hook
- The hook name to check
Throws
InvalidArgumentExceptionon invalid hooks
console()source public
console( Cake\Console\CommandCollection $commands )Add console commands for the plugin.
Parameters
- Cake\Console\CommandCollection- $commands
- The command collection to update
Returns
Cake\Console\CommandCollectionImplementation of
Cake\Core\PluginInterface::console()
  disable()source public
disable( string $hook )Disables the named hook
Parameters
- 
     string $hook
- The hook to disable
Returns
$this
Implementation of
Cake\Core\PluginInterface::disable()
  enable()source public
enable( string $hook )Enables the named hook
Parameters
- 
     string $hook
- The hook to disable
Returns
$this
Implementation of
Cake\Core\PluginInterface::enable()
  getClassPath()source public
getClassPath( )Get the filesystem path to configuration for this plugin
Returns
stringImplementation of
Cake\Core\PluginInterface::getClassPath()
  getConfigPath()source public
getConfigPath( )Get the filesystem path to configuration for this plugin
Returns
stringImplementation of
Cake\Core\PluginInterface::getConfigPath()
  getName()source public
getName( )Get the name of this plugin.
Returns
stringImplementation of
Cake\Core\PluginInterface::getName()
  getPath()source public
getPath( )Get the filesystem path to this plugin
Returns
stringImplementation of
Cake\Core\PluginInterface::getPath()
  initialize()source public
initialize( )isEnabled()source public
isEnabled( string $hook )Check if the named hook is enabled
Parameters
- 
     string $hook
- The hook to check
Returns
booleanImplementation of
Cake\Core\PluginInterface::isEnabled()
  middleware()source public
middleware( Cake\Http\MiddlewareQueue $middleware )Add middleware for the plugin.
Parameters
- Cake\Http\MiddlewareQueue- $middleware
- The middleware queue to update.
Returns
Cake\Http\MiddlewareQueueImplementation of
Cake\Core\PluginInterface::middleware()
  routes()source public
routes( Cake\Routing\RouteBuilder $routes )Add routes for the plugin.
Parameters
- Cake\Routing\RouteBuilder- $routes
- The route builder to update.
Implementation of
Cake\Core\PluginInterface::routes()
  Properties detail
© 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/3.8/class-Cake.Core.BasePlugin.html