\Piko\ModularApplication
This class implements a modular application
Properties summary
Name | Description |
---|---|
public $bootstrap |
List of module IDs that should be run during the a… |
public $modules |
List of modules configurations. Should be either :… |
Inherited Properties
Name | Description |
---|---|
public $basePath |
The absolute base path of the application. |
public $behaviors |
Behaviors container. |
public $components |
The components container |
public $defaultLayout |
The default layout name without file extension. |
public $defaultLayoutPath |
The default layout path. An alias could be used. |
public $errorHandler |
|
public $errorRoute |
The Error route to display exceptions in a friendl… |
public $language |
The language that is meant to be used for end user… |
protected $eventDispatcher |
|
protected $listenerProvider |
|
protected $pipeline |
Methods summary
Name | Description |
---|---|
public __construct |
Constructor |
public getModule |
Get a module instance |
public parseRoute |
Parse a route and return an array containing the m… |
public run |
Run the application. |
Inherited Methods
Name | Description |
---|---|
public __call |
Magic method to call a behavior. |
public __construct |
Constructor |
public attachBehavior |
Attach a behavior to the class instance. |
public detachBehavior |
Detach a behavior. |
public getComponent |
Retrieve a unique instance of a registered compone… |
public handle |
{@inheritDoc} |
public on |
Registers an event listener. |
public pipe |
Add a middleware in the application pipeline queue… |
public run |
Run the application. |
public trigger |
Trigger an event that may be listen by event liste… |
Properties
public $bootstrap : string[]
List of module IDs that should be run during the application bootstrapping process. Each module may be specified with a module ID as specified via [[modules]].
During the bootstrapping process, each module will be instantiated. If the module class implements the bootstrap() method, this method will be also be called.
public $modules : array<string,string|array<string,mixed>|callable|\Piko\Module>
List of modules configurations. Should be either :
[
'moduleId' => 'moduleClassName'
]
Or :
[
'moduleId' => [
'class' => 'moduleClassName',
'layoutPath' => '/some/path'
// ...
]
]
see \Piko\ModuleTo have more informations on module attributes
Methods
public __construct(): void
public __construct(array<string,string|array<string,mixed>> $config = []): void
Constructor
Parameters
$config (default: []): The application configuration.
public getModule(): \Piko\Module
public getModule(string $moduleId): \Piko\Module
Get a module instance
Parameters
$moduleId : The module identifier
throws \RuntimeException
Return:
\Piko\Module instance
public parseRoute(): (string|null)[]
public static parseRoute(string $route): (string|null)[]
Parse a route and return an array containing the module’s id, the controller’s id and the action’s id.
Parameters
$route : The route to parse. The route format is one of the following :
'{moduleId}/{subModuleId}/.../{controllerId}/{actionId}'
'{moduleId}/{controllerId}/{actionId}'
'{moduleId}/{controllerId}'
'{moduleId}'
Return:
(string|null)[]
public run(): void
public run(\Psr\Http\Message\ServerRequestInterface $request = null, bool $emitHeaders = true): void
Run the application.
Parameters
$request (default: null):
$emitHeaders (default: true): Controls whether headers will be emmited (header() function called)
see \Piko\Application::run()