PluginInterface
in
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
console()
Add console commands for the plugin.
public
console(CommandCollection $commands) : CommandCollection
Parameters
- $commands : CommandCollection
-
The command collection to update
Return values
CommandCollectiondisable()
Disables the named hook
public
disable(string $hook) : $this
Parameters
- $hook : string
-
The hook to disable
Return values
$thisenable()
Enables the named hook
public
enable(string $hook) : $this
Parameters
- $hook : string
-
The hook to disable
Return values
$thisgetClassPath()
Get the filesystem path to configuration for this plugin
public
getClassPath() : string
Return values
stringgetConfigPath()
Get the filesystem path to configuration for this plugin
public
getConfigPath() : string
Return values
stringgetName()
Get the name of this plugin.
public
getName() : string
Return values
stringgetPath()
Get the filesystem path to this plugin
public
getPath() : string
Return values
stringgetTemplatePath()
Get the filesystem path to templates for this plugin
public
getTemplatePath() : string
Return values
stringisEnabled()
Check if the named hook is enabled
public
isEnabled(string $hook) : bool
Parameters
- $hook : string
-
The hook to check
Return values
boolmiddleware()
Add middleware for the plugin.
public
middleware(MiddlewareQueue $middlewareQueue) : MiddlewareQueue
Parameters
- $middlewareQueue : MiddlewareQueue
-
The middleware queue to update.
Return values
MiddlewareQueueroutes()
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.