Fr3nch13/CakePHP Utilities

PluginApplicationInterface extends EventDispatcherInterface

Interface for Applications that leverage plugins & events.

Events can be bound to the application event manager during the application's bootstrap and plugin bootstrap.

Table of Contents

Methods

addPlugin()  : $this
Add a plugin to the loaded plugin set.
dispatchEvent()  : EventInterface
Wrapper for creating and dispatching events.
getEventManager()  : EventManagerInterface
Returns the Cake\Event\EventManager manager instance for this object.
pluginBootstrap()  : void
Run bootstrap logic for loaded plugins.
pluginConsole()  : CommandCollection
Run console hooks for plugins
pluginMiddleware()  : MiddlewareQueue
Run middleware hooks for plugins
pluginRoutes()  : RouteBuilder
Run routes hooks for loaded plugins
setEventManager()  : $this
Sets the Cake\Event\EventManager manager instance for this object.

Methods

addPlugin()

Add a plugin to the loaded plugin set.

public addPlugin(PluginInterface|string $name[, array<string, mixed> $config = [] ]) : $this

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
$name : PluginInterface|string

The plugin name or plugin object.

$config : array<string, mixed> = []

The configuration data for the plugin if using a string for $name

Return values
$this

dispatchEvent()

Wrapper for creating and dispatching events.

public dispatchEvent(string $name[, array<string|int, mixed>|null $data = null ][, object|null $subject = null ]) : EventInterface

Returns a dispatched event.

Parameters
$name : string

Name of the event.

$data : array<string|int, mixed>|null = null

Any value you wish to be transported with this event to it can be read by listeners.

$subject : object|null = null

The object that this event applies to ($this by default).

Return values
EventInterface

setEventManager()

Sets the Cake\Event\EventManager manager instance for this object.

public setEventManager(EventManagerInterface $eventManager) : $this

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
$eventManager : EventManagerInterface

the eventManager to set

Return values
$this

        
On this page

Search results