Interface PluginApplicationInterface
Interface for Applications that leverage plugins & events.
Events can be bound to the application event manager during the application's bootstrap and plugin bootstrap.
Method Summary
-
addPlugin() public
Add a plugin to the loaded plugin set.
-
dispatchEvent() public
Wrapper for creating and dispatching events.
-
eventManager() public deprecated
Returns the Cake\Event\EventManager manager instance for this object.
-
getEventManager() public @method
-
pluginBootstrap() public
Run bootstrap logic for loaded plugins.
-
pluginConsole() public
Run console hooks for plugins
-
pluginMiddleware() public
Run middleware hooks for plugins
-
pluginRoutes() public
Run routes hooks for loaded plugins
-
setEventManager() public @method
Method Detail
addPlugin() ¶ public
addPlugin(string|Cake\Core\PluginInterface $name, array $config = []): $this
Add a plugin to the loaded plugin set.
If the named plugin does not exist, or does not define a Plugin class, an
instance of Cake\Core\BasePlugin
will be used. This generated class will have
all plugin hooks enabled.
Parameters
-
string|Cake\Core\PluginInterface
$name The plugin name or plugin object.
-
array
$config optional The configuration data for the plugin if using a string for $name
Returns
$this
dispatchEvent() ¶ public
dispatchEvent(string $name, array|null $data = null, object|null $subject = null): Cake\Event\Event
Wrapper for creating and dispatching events.
Returns a dispatched event.
Parameters
-
string
$name Name of the event.
-
array|null
$data optional Any value you wish to be transported with this event to it can be read by listeners.
-
object|null
$subject optional The object that this event applies to ($this by default).
Returns
Cake\Event\Event
eventManager() ¶ public
eventManager(Cake\Event\EventManager|null $eventManager = null): Cake\Event\EventManager
Returns the Cake\Event\EventManager manager instance for this object.
You can use this instance to register any new listeners or callbacks to the object events, or create your own events and trigger them at will.
Parameters
-
Cake\Event\EventManager|null
$eventManager optional the eventManager to set
Returns
Cake\Event\EventManager
getEventManager() ¶ public @method
getEventManager(): Cake\Event\EventManager
Returns
Cake\Event\EventManager
pluginBootstrap() ¶ public
pluginBootstrap(): void
Run bootstrap logic for loaded plugins.
Returns
void
pluginConsole() ¶ public
pluginConsole(Cake\Console\CommandCollection $commands): Cake\Console\CommandCollection
Run console hooks for plugins
Parameters
-
Cake\Console\CommandCollection
$commands The CommandCollection to use.
Returns
Cake\Console\CommandCollection
pluginMiddleware() ¶ public
pluginMiddleware(Cake\Http\MiddlewareQueue $middleware): Cake\Http\MiddlewareQueue
Run middleware hooks for plugins
Parameters
-
Cake\Http\MiddlewareQueue
$middleware The MiddlewareQueue to use.
Returns
Cake\Http\MiddlewareQueue
pluginRoutes() ¶ public
pluginRoutes(Cake\Routing\RouteBuilder $routes): Cake\Routing\RouteBuilder
Run routes hooks for loaded plugins
Parameters
-
Cake\Routing\RouteBuilder
$routes The route builder to use.
Returns
Cake\Routing\RouteBuilder
setEventManager() ¶ public @method
setEventManager(Cake\Event\EventManager $eventManager): $this
Parameters
-
Cake\Event\EventManager
$eventManager
Returns
$this