W3cubDocs

/CakePHP 4.4

Interface PluginInterface

Plugin Interface

Namespace: Cake\Core

Constants

  • array<string>
    VALID_HOOKS
    ['bootstrap', 'console', 'middleware', 'routes', 'services']

    List of valid hooks.

Method Summary

  • bootstrap() public

    Load all the application configuration and bootstrap logic.

  • console() public

    Add console commands for the plugin.

  • disable() public

    Disables the named hook

  • enable() public

    Enables the named hook

  • getClassPath() public

    Get the filesystem path to configuration for this plugin

  • getConfigPath() public

    Get the filesystem path to configuration for this plugin

  • getName() public

    Get the name of this plugin.

  • getPath() public

    Get the filesystem path to this plugin

  • getTemplatePath() public

    Get the filesystem path to templates for this plugin

  • isEnabled() public

    Check if the named hook is enabled

  • middleware() public

    Add middleware for the plugin.

  • routes() public

    Add routes for the plugin.

  • services() public @method

    Register plugin services to the application's container

Method Detail

bootstrap() public

bootstrap(Cake\Core\PluginApplicationInterface $app): void

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.

Parameters

Cake\Core\PluginApplicationInterface $app

The host application

Returns

void

console() public

console(Cake\Console\CommandCollection $commands): Cake\Console\CommandCollection

Add console commands for the plugin.

Parameters

Cake\Console\CommandCollection $commands

The command collection to update

Returns

Cake\Console\CommandCollection

disable() public

disable(string $hook): $this

Disables the named hook

Parameters

string $hook

The hook to disable

Returns

$this

enable() public

enable(string $hook): $this

Enables the named hook

Parameters

string $hook

The hook to disable

Returns

$this

getClassPath() public

getClassPath(): string

Get the filesystem path to configuration for this plugin

Returns

string

getConfigPath() public

getConfigPath(): string

Get the filesystem path to configuration for this plugin

Returns

string

getName() public

getName(): string

Get the name of this plugin.

Returns

string

getPath() public

getPath(): string

Get the filesystem path to this plugin

Returns

string

getTemplatePath() public

getTemplatePath(): string

Get the filesystem path to templates for this plugin

Returns

string

isEnabled() public

isEnabled(string $hook): bool

Check if the named hook is enabled

Parameters

string $hook

The hook to check

Returns

bool

middleware() public

middleware(Cake\Http\MiddlewareQueue $middlewareQueue): Cake\Http\MiddlewareQueue

Add middleware for the plugin.

Parameters

Cake\Http\MiddlewareQueue $middlewareQueue

The middleware queue to update.

Returns

Cake\Http\MiddlewareQueue

routes() public

routes(Cake\Routing\RouteBuilder $routes): void

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.

Parameters

Cake\Routing\RouteBuilder $routes

The route builder to update.

Returns

void

services() public @method

services(Cake\Core\ContainerInterface $container): void

Register plugin services to the application's container

Parameters

Cake\Core\ContainerInterface $container

Returns

void

© 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.4/interface-Cake.Core.PluginInterface.html