App
in package
Represents a web application that handles and responds to HTTP requests.
Table of Contents
Methods
- create() : App
- Creates a singleton web-based application.
- receive() : void
- Handle and respond to requests from clients.
- use() : App
- Queue the given PSR-15 middleware.
- useAuthorization() : App
- Configures the application for checking route authorization.
- useCsrfMiddleware() : App
- Configures the server for CSRF attack mitigation.
- useSession() : App
- Configures a session.
Methods
create()
Creates a singleton web-based application.
public
static create(ContainerInterface $container) : App
Parameters
- $container : ContainerInterface
Return values
App —receive()
Handle and respond to requests from clients.
public
receive(ServerRequestInterface $request) : void
Parameters
- $request : ServerRequestInterface
Return values
void —use()
Queue the given PSR-15 middleware.
public
use(MiddlewareInterface $middleware) : App
Parameters
- $middleware : MiddlewareInterface
Tags
Return values
App —useAuthorization()
Configures the application for checking route authorization.
public
useAuthorization() : App
Return values
App —useCsrfMiddleware()
Configures the server for CSRF attack mitigation.
public
useCsrfMiddleware([array<string, bool|int|float|string> $sessionOpts = ["cookie_httponly" => true, "cookie_samesite" => "Strict", "cookie_secure" => true, "cookie_path" => true, "use_strict_mode" => true, "referer_check" => true] ]) : App
The server will not process the request if the CSRF check fails. The current response will be set up for CSRF detection.
Parameters
- $sessionOpts : array<string, bool|int|float|string> = ["cookie_httponly" => true, "cookie_samesite" => "Strict", "cookie_secure" => true, "cookie_path" => true, "use_strict_mode" => true, "referer_check" => true]
Return values
App —useSession()
Configures a session.
public
useSession([array<string, mixed> $options = ["cookie_httponly" => true, "cookie_samesite" => "Strict", "cookie_secure" => true, "cookie_path" => true, "use_strict_mode" => true, "referer_check" => true] ]) : App
Parameters
- $options : array<string, mixed> = ["cookie_httponly" => true, "cookie_samesite" => "Strict", "cookie_secure" => true, "cookie_path" => true, "use_strict_mode" => true, "referer_check" => true]