CakePHP
  • Documentation
    • Book
    • API
    • Videos
    • Logos & Trademarks
  • Business Solutions
  • Swag
  • Road Trip
  • Team
  • Community
    • Community
    • Team
    • Issues (Github)
    • YouTube Channel
    • Get Involved
    • Bakery
    • Featured Resources
    • Newsletter
    • Certification
    • My CakePHP
    • CakeFest
    • Facebook
    • Twitter
    • Help & Support
    • Forum
    • Stack Overflow
    • IRC
    • Slack
    • Paid Support
CakePHP

C CakePHP 3.8 Red Velvet API

  • Overview
  • Tree
  • Deprecated
  • Version:
    • 3.8
      • 3.8
      • 3.7
      • 3.6
      • 3.5
      • 3.4
      • 3.3
      • 3.2
      • 3.1
      • 3.0
      • 2.10
      • 2.9
      • 2.8
      • 2.7
      • 2.6
      • 2.5
      • 2.4
      • 2.3
      • 2.2
      • 2.1
      • 2.0
      • 1.3
      • 1.2

Namespaces

  • Cake
    • Auth
      • Storage
    • Cache
      • Engine
    • Collection
      • Iterator
    • Command
    • Console
      • Exception
    • Controller
      • Component
      • Exception
    • Core
      • Configure
        • Engine
      • Exception
      • Retry
    • Database
      • Driver
      • Exception
      • Expression
      • Schema
      • Statement
      • Type
    • Datasource
      • Exception
    • Error
      • Middleware
    • Event
      • Decorator
    • Filesystem
    • Form
    • Http
      • Client
        • Adapter
        • Auth
      • Cookie
      • Exception
      • Middleware
      • Session
    • I18n
      • Formatter
      • Middleware
      • Parser
    • Log
      • Engine
    • Mailer
      • Exception
      • Transport
    • Network
      • Exception
    • ORM
      • Association
      • Behavior
        • Translate
      • Exception
      • Locator
      • Rule
    • Routing
      • Exception
      • Filter
      • Middleware
      • Route
    • Shell
      • Helper
      • Task
    • TestSuite
      • Fixture
      • Stub
    • Utility
      • Exception
    • Validation
    • View
      • Exception
      • Form
      • Helper
      • Widget
  • None

Classes

  • ActionDispatcher
  • BaseApplication
  • Client
  • ControllerFactory
  • CorsBuilder
  • MiddlewareQueue
  • Response
  • ResponseEmitter
  • Runner
  • Server
  • ServerRequest
  • ServerRequestFactory
  • Session

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, Cake\Core\PluginApplicationInterface uses Cake\Event\EventDispatcherTrait
Abstract
Namespace: Cake\Http
Location: Http/BaseApplication.php

Properties summary

  • $configDir protected
    string
    Contains the path of the config directory
  • $plugins protected
    Cake\Core\PluginCollection
    Plugin Collection

Inherited Properties

  • _eventClass, _eventManager

Method Summary

  • __construct() public
    Constructor
  • __invoke() public
    Invoke the application.
  • addPlugin() public
    Add a plugin to the loaded plugin set.
  • bootstrap() public
    Load all the application configuration and bootstrap logic.
  • console() public
    Define the console commands for an application.
  • getDispatcher() protected
    Get the ActionDispatcher.
  • getPlugins() public
    Get the plugin collection in use.
  • makePlugin() protected
    Create a plugin instance from a classname and configuration
  • middleware() abstract public
  • 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
  • routes() public
    Define the routes for an application.

Method Detail

__construct() public ¶

__construct( string $configDir , Cake\Event\EventManagerInterface $eventManager = null )

Constructor

Parameters
string $configDir
The directory the bootstrap configuration is held in.
Cake\Event\EventManagerInterface $eventManager optional null
Application event manager instance.

__invoke() 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()

addPlugin() public ¶

addPlugin( string|Cake\Core\PluginInterface $name , array $config = [] )

Add a plugin to the loaded plugin set.

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
Implementation of
Cake\Core\PluginApplicationInterface::addPlugin()

bootstrap() public ¶

bootstrap( )

Load all the application configuration and bootstrap logic.

Implementation of
Cake\Core\ConsoleApplicationInterface::bootstrap()

console() 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() protected ¶

getDispatcher( )

Get the ActionDispatcher.

Returns
Cake\Http\ActionDispatcher

getPlugins() public ¶

getPlugins( )

Get the plugin collection in use.

Returns
Cake\Core\PluginCollection

makePlugin() protected ¶

makePlugin( string $name , array $config )

Create a plugin instance from a classname and configuration

Parameters
string $name
The plugin classname
array $config
Configuration options for the plugin
Returns
Cake\Core\PluginInterface

middleware() 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()

pluginBootstrap() public ¶

pluginBootstrap( )

Run bootstrap logic for loaded plugins.

Implementation of
Cake\Core\PluginApplicationInterface::pluginBootstrap()

pluginConsole() public ¶

pluginConsole( Cake\Console\CommandCollection $commands )

Run console hooks for plugins

Parameters
Cake\Console\CommandCollection $commands
The CommandCollection to use.
Returns
Cake\Console\CommandCollection
Implementation of
Cake\Core\PluginApplicationInterface::pluginConsole()

pluginMiddleware() public ¶

pluginMiddleware( Cake\Http\MiddlewareQueue $middleware )

Run middleware hooks for plugins

Parameters
Cake\Http\MiddlewareQueue $middleware
The MiddlewareQueue to use.
Returns
Cake\Http\MiddlewareQueue
Implementation of
Cake\Core\PluginApplicationInterface::pluginMiddleware()

pluginRoutes() public ¶

pluginRoutes( Cake\Routing\RouteBuilder $routes )

Run routes hooks for loaded plugins

Parameters
Cake\Routing\RouteBuilder $routes
The route builder to use.
Returns
Cake\Routing\RouteBuilder
Implementation of
Cake\Core\PluginApplicationInterface::pluginRoutes()

routes() 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()

Methods used from Cake\Event\EventDispatcherTrait

dispatchEvent() public ¶

dispatchEvent( string $name , array|null $data = null , object|null $subject = null )

Wrapper for creating and dispatching events.

Returns a dispatched event.

Parameters
string $name
Name of the event.
array|null $data optional null

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

object|null $subject optional null

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

Returns
Cake\Event\Event

eventManager() public deprecated ¶

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.

Deprecated
3.5.0 Use getEventManager()/setEventManager() instead.
Parameters
Cake\Event\EventManager $eventManager optional null
the eventManager to set
Returns
Cake\Event\EventManager

getEventManager() public ¶

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.

Returns
Cake\Event\EventManager

setEventManager() public ¶

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.

Parameters
Cake\Event\EventManager $eventManager
the eventManager to set
Returns

$this

Magic methods inherited from Cake\Event\EventDispatcherInterface

getEventManager()

Properties detail

$configDir ¶

protected string

Contains the path of the config directory

$plugins ¶

protected Cake\Core\PluginCollection

Plugin Collection

Follow @CakePHP
#IRC
OpenHub
Rackspace
  • Business Solutions
  • Showcase
  • Documentation
  • Book
  • API
  • Videos
  • Logos & Trademarks
  • Community
  • Team
  • Issues (Github)
  • YouTube Channel
  • Get Involved
  • Bakery
  • Featured Resources
  • Newsletter
  • Certification
  • My CakePHP
  • CakeFest
  • Facebook
  • Twitter
  • Help & Support
  • Forum
  • Stack Overflow
  • IRC
  • Slack
  • Paid Support

Generated using CakePHP API Docs