Fr3nch13/CakePHP Utilities

PluginInterface

Plugin Interface

Table of Contents

Constants

VALID_HOOKS  = ['bootstrap', 'console', 'middleware', 'routes', 'services']
List of valid hooks.

Methods

bootstrap()  : void
Load all the application configuration and bootstrap logic.
console()  : CommandCollection
Add console commands for the plugin.
disable()  : $this
Disables the named hook
enable()  : $this
Enables the named hook
getClassPath()  : string
Get the filesystem path to configuration for this plugin
getConfigPath()  : string
Get the filesystem path to configuration for this plugin
getName()  : string
Get the name of this plugin.
getPath()  : string
Get the filesystem path to this plugin
getTemplatePath()  : string
Get the filesystem path to templates for this plugin
isEnabled()  : bool
Check if the named hook is enabled
middleware()  : MiddlewareQueue
Add middleware for the plugin.
routes()  : void
Add routes for the plugin.

Constants

VALID_HOOKS

List of valid hooks.

public array<string|int, string> VALID_HOOKS = ['bootstrap', 'console', 'middleware', 'routes', 'services']

Methods

bootstrap()

Load all the application configuration and bootstrap logic.

public bootstrap(PluginApplicationInterface $app) : void

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
$app : PluginApplicationInterface

The host application

disable()

Disables the named hook

public disable(string $hook) : $this
Parameters
$hook : string

The hook to disable

Return values
$this

enable()

Enables the named hook

public enable(string $hook) : $this
Parameters
$hook : string

The hook to disable

Return values
$this

getClassPath()

Get the filesystem path to configuration for this plugin

public getClassPath() : string
Return values
string

getConfigPath()

Get the filesystem path to configuration for this plugin

public getConfigPath() : string
Return values
string

getName()

Get the name of this plugin.

public getName() : string
Return values
string

getPath()

Get the filesystem path to this plugin

public getPath() : string
Return values
string

getTemplatePath()

Get the filesystem path to templates for this plugin

public getTemplatePath() : string
Return values
string

isEnabled()

Check if the named hook is enabled

public isEnabled(string $hook) : bool
Parameters
$hook : string

The hook to check

Return values
bool

routes()

Add routes for the plugin.

public routes(RouteBuilder $routes) : void

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
$routes : RouteBuilder

The route builder to update.


        
On this page

Search results