\Piko\Application
The main application class
Properties summary
Name | Description |
---|---|
public $basePath |
The absolute base path of the application. |
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 $pipeline |
Inherited Properties
Name | Description |
---|---|
public $behaviors |
Behaviors container. |
protected $eventDispatcher |
|
protected $listenerProvider |
Methods summary
Name | Description |
---|---|
public __construct |
Constructor |
public getComponent |
Retrieve a unique instance of a registered compone… |
public handle |
{@inheritDoc} |
public pipe |
Add a middleware in the application pipeline queue… |
public run |
Run the application. |
Inherited Methods
Name | Description |
---|---|
public __call |
Magic method to call a behavior. |
public attachBehavior |
Attach a behavior to the class instance. |
public detachBehavior |
Detach a behavior. |
public on |
Registers an event listener. |
public trigger |
Trigger an event that may be listen by event liste… |
Properties
public $basePath : string
The absolute base path of the application.
public $components : (object|callable)[]
The components container
public $defaultLayout : string
The default layout name without file extension.
public $defaultLayoutPath : string
The default layout path. An alias could be used.
public $errorHandler : \Psr\Http\Server\RequestHandlerInterface
public $errorRoute : string
The Error route to display exceptions in a friendly way. If not set, Exceptions catched will be thrown and stop the script execution.
public $language : string
The language that is meant to be used for end users.
protected $pipeline : \SplQueue<\Psr\Http\Server\MiddlewareInterface>
Methods
public __construct(): void
public __construct(array<string,string|array<string,mixed>> $config = []): void
Constructor
Parameters
$config (default: []): The application configuration.
public getComponent(): object
public getComponent(string $type): object
Retrieve a unique instance of a registered component
Parameters
$type : The component class
throws \RuntimeExceptionIf the component is not found
Return:
object
public handle(): \Psr\Http\Message\ResponseInterface
public handle(\Psr\Http\Message\ServerRequestInterface $request): \Psr\Http\Message\ResponseInterface
{@inheritDoc}
Parameters
$request :
see \Psr\Http\Server\RequestHandlerInterface::handle()
Return:
\Psr\Http\Message\ResponseInterface
public pipe(): void
public pipe(\Psr\Http\Server\MiddlewareInterface $middleware): void
Add a middleware in the application pipeline queue
Parameters
$middleware :
see \Psr\Http\Server\MiddlewareInterface
public run(): void
public run(\Psr\Http\Message\ServerRequestInterface|null $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)