Class BaseApplication

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.

Cake\Http\BaseApplication implements Cake\Core\ConsoleApplicationInterface, Cake\Core\HttpApplicationInterface
Abstract
Namespace: Cake\Http
Location: Http/BaseApplication.php

Properties summary

  • $configDir protected
    string
    Contains the path of the config directory

Method Summary

Method Detail

__construct()source public

__construct( string $configDir )

Constructor

Parameters

string $configDir
The directory the bootstrap configuration is held in.

__invoke()source public

__invoke( Psr\Http\Message\ServerRequestInterface $request , Psr\Http\Message\ResponseInterface $response , callable $next )

Invoke the application.

  • Convert the PSR response into CakePHP equivalents.
  • Create the controller that will handle this request.
  • Invoke the controller.

Parameters

Psr\Http\Message\ServerRequestInterface $request
The request
Psr\Http\Message\ResponseInterface $response
The response
callable $next
The next middleware

Returns

Psr\Http\Message\ResponseInterface

Implementation of

Cake\Core\HttpApplicationInterface::__invoke()

bootstrap()source public

bootstrap( )

Load all the application configuration and bootstrap logic.

Implementation of

Cake\Core\ConsoleApplicationInterface::bootstrap()

console()source public

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.

Parameters

Cake\Console\CommandCollection $commands
The CommandCollection to add commands into.

Returns

Cake\Console\CommandCollection
The updated collection.

Implementation of

Cake\Core\ConsoleApplicationInterface::console()

getDispatcher()source protected

getDispatcher( )

Get the ActionDispatcher.

Returns

Cake\Http\ActionDispatcher

middleware()source abstract public

middleware( Cake\Http\MiddlewareQueue $middleware )

Parameters

Cake\Http\MiddlewareQueue $middleware
The middleware queue to set in your App Class

Returns

Cake\Http\MiddlewareQueue

Implementation of

Cake\Core\HttpApplicationInterface::middleware()

routes()source public

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.

Parameters

Cake\Routing\RouteBuilder $routes
A route builder to add routes into.

Implementation of

Cake\Core\HttpApplicationInterface::routes()

Properties detail

$configDirsource

protected string

Contains the path of the config directory

© 2005–2017 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.4/class-Cake.Http.BaseApplication.html