Base class for application classes.
The application class is responsible for bootstrapping the application, and ensuring that middleware is attached. It is also invoked as the last piece of middleware, and delegates request/response handling to the correct controller.
$configDir
protected string
$plugins
protected __construct( string $configDir , Cake\Event\EventManagerInterface $eventManager null )
Constructor
$configDir
Cake\Event\EventManagerInterface
$eventManager
optional null __invoke( Psr\Http\Message\ServerRequestInterface $request , Psr\Http\Message\ResponseInterface $response , callable $next )
Invoke the application.
$request
$response
$next
Cake\Core\HttpApplicationInterface::__invoke()
addPlugin( string|Cake\Core\PluginInterface $name , array $config [] )
Add a plugin to the loaded plugin set.
Cake\Core\PluginInterface
$name
$config
optional [] Cake\Core\PluginApplicationInterface::addPlugin()
bootstrap( )
Load all the application configuration and bootstrap logic.
Cake\Core\ConsoleApplicationInterface::bootstrap()
console( Cake\Console\CommandCollection $commands )
Define the console commands for an application.
By default all commands in CakePHP, plugins and the application will be loaded using conventions based names.
Cake\Console\CommandCollection
$commands
Cake\Console\CommandCollection
Cake\Core\ConsoleApplicationInterface::console()
getDispatcher( )
Get the ActionDispatcher.
Cake\Http\ActionDispatcher
getPlugins( )
Get the plugin collection in use.
Cake\Core\PluginCollection
makePlugin( string $name , array $config )
Create a plugin instance from a classname and configuration
$name
$config
Cake\Core\PluginInterface
middleware( Cake\Http\MiddlewareQueue $middleware )
Cake\Http\MiddlewareQueue
$middleware
Cake\Http\MiddlewareQueue
Cake\Core\HttpApplicationInterface::middleware()
pluginBootstrap( )
Run bootstrap logic for loaded plugins.
Cake\Core\PluginApplicationInterface::pluginBootstrap()
pluginConsole( Cake\Console\CommandCollection $commands )
Run console hooks for plugins
Cake\Console\CommandCollection
$commands
Cake\Console\CommandCollection
Cake\Core\PluginApplicationInterface::pluginConsole()
pluginMiddleware( Cake\Http\MiddlewareQueue $middleware )
Run middleware hooks for plugins
Cake\Http\MiddlewareQueue
$middleware
Cake\Http\MiddlewareQueue
Cake\Core\PluginApplicationInterface::pluginMiddleware()
pluginRoutes( Cake\Routing\RouteBuilder $routes )
Run routes hooks for loaded plugins
Cake\Routing\RouteBuilder
$routes
Cake\Routing\RouteBuilder
Cake\Core\PluginApplicationInterface::pluginRoutes()
routes( Cake\Routing\RouteBuilder $routes )
Define the routes for an application.
By default this will load config/routes.php
for ease of use and backwards compatibility.
Cake\Routing\RouteBuilder
$routes
Cake\Core\HttpApplicationInterface::routes()
dispatchEvent( string $name , array|null $data null , object|null $subject null )
Wrapper for creating and dispatching events.
Returns a dispatched event.
$name
$data
optional null Any value you wish to be transported with this event to it can be read by listeners.
$subject
optional null The object that this event applies to ($this by default).
Cake\Event\Event
eventManager( Cake\Event\EventManager $eventManager null )
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.
Cake\Event\EventManager
$eventManager
optional null Cake\Event\EventManager
getEventManager( )
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.
Cake\Event\EventManager
setEventManager( Cake\Event\EventManager $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.
Cake\Event\EventManager
$eventManager
getEventManager() |
© 2005–2018 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/3.6/class-Cake.Http.BaseApplication.html