classe Application étends Router (Voir la source)

Propriétés

protected array $error_code

Define the functions related to an http code executed if this code is up

depuis  Router
protected array $middlewares

Define the global middleware

depuis  Router
protected string $prefix

Define the routing prefix

depuis  Router
protected string $special_method depuis  Router
protected array $current

Method Http current.

depuis  Router
protected bool $auto_csrf

Define the auto csrf check status.

depuis  Router
static protected array $routes

Route collection.

depuis  Router

Méthodes

void
__construct(Request $request, Response $response)

Application constructor

setBaseRoute(string $base_route)

Set the base route

depuis  Router
setAutoCsrf(bool $auto_csrf)

Set auto CSRF status Note: Disable only you run on test env

depuis  Router
prefix(string $prefix, callable $cb)

Add a prefix on the roads

depuis  Router
middleware(array $middlewares)

Allows to associate a global middleware on an route

depuis  Router
route(array $definition)

Route mapper

depuis  Router
any(string $path, callable|string|array $cb)

Add a route for

depuis  Router
get(string $path, callable|string|array $cb)

Add a GET route

depuis  Router
post(string $path, callable|string|array $cb)

Add a POST route

depuis  Router
delete(string $path, callable|string|array $cb)

Add a DELETE route

depuis  Router
put(string $path, callable|string|array $cb)

Add a PUT route

depuis  Router
patch(string $path, callable|string|array $cb)

Add a PATCH route

depuis  Router
options(string $path, callable $cb)

Add a OPTIONS route

depuis  Router
code(int $code, callable $cb)

Launch a callback function for each HTTP error code.

depuis  Router
match(array $methods, string $path, callable|string|array $cb)

Match route de tout type de method

depuis  Router
string
getSpecialMethod()

Retrieve the define special method

depuis  Router
bool
hasSpecialMethod()

Check user define the special method

depuis  Router
array
getRoutes()

Get the route collection

depuis  Router
getContainer()

Get container

void
bind(Loader $config)

Configuration Association

static Application
make(Request $request, Response $response)

Build the application

mixed
send()

Launcher of the application

void
disablePoweredByMention()

Allows you to enable writing the X-Powered-By header in the answer of the inquiry.

rest(string $url, string|array $controller_name, array $where = [])

Make the REST API base on route and ressource controller.

void
abort($code = 500, $message = '', array $headers = [])

Abort application

Capsule|mixed
container(null $name = null, callable $callable = null)

Build dependance

__invoke(array ...$params)

__invoke

Détails

protected void __construct(Request $request, Response $response)

Application constructor

Paramètres

Request $request
Response $response

Valeur de retour

void

setBaseRoute(string $base_route)

Set the base route

Paramètres

string $base_route

setAutoCsrf(bool $auto_csrf)

Set auto CSRF status Note: Disable only you run on test env

Paramètres

bool $auto_csrf

Router prefix(string $prefix, callable $cb)

Add a prefix on the roads

Paramètres

string $prefix
callable $cb

Valeur de retour

Router

Exceptions

Router middleware(array $middlewares)

Allows to associate a global middleware on an route

Paramètres

array $middlewares

Valeur de retour

Router

route(array $definition)

Route mapper

Paramètres

array $definition

Exceptions

RouterException

Router any(string $path, callable|string|array $cb)

Add a route for

GET, POST, DELETE, PUT, OPTIONS, PATCH

Paramètres

string $path
callable|string|array $cb

Valeur de retour

Router

Exceptions

Route get(string $path, callable|string|array $cb)

Add a GET route

Paramètres

string $path
callable|string|array $cb

Valeur de retour

Route

Route post(string $path, callable|string|array $cb)

Add a POST route

Paramètres

string $path
callable|string|array $cb

Valeur de retour

Route

Route delete(string $path, callable|string|array $cb)

Add a DELETE route

Paramètres

string $path
callable|string|array $cb

Valeur de retour

Route

Route put(string $path, callable|string|array $cb)

Add a PUT route

Paramètres

string $path
callable|string|array $cb

Valeur de retour

Route

Route patch(string $path, callable|string|array $cb)

Add a PATCH route

Paramètres

string $path
callable|string|array $cb

Valeur de retour

Route

Route options(string $path, callable $cb)

Add a OPTIONS route

Paramètres

string $path
callable $cb

Valeur de retour

Route

Router code(int $code, callable $cb)

Launch a callback function for each HTTP error code.

When the define code match with response code.

Paramètres

int $code
callable $cb

Valeur de retour

Router

Router match(array $methods, string $path, callable|string|array $cb)

Match route de tout type de method

Paramètres

array $methods
string $path
callable|string|array $cb

Valeur de retour

Router

protected string getSpecialMethod()

Retrieve the define special method

Valeur de retour

string

protected bool hasSpecialMethod()

Check user define the special method

Valeur de retour

bool

array getRoutes()

Get the route collection

Valeur de retour

array

Capsule getContainer()

Get container

Valeur de retour

Capsule

void bind(Loader $config)

Configuration Association

Paramètres

Loader $config

Valeur de retour

void

static Application make(Request $request, Response $response)

Build the application

Paramètres

Request $request
Response $response

Valeur de retour

Application

mixed send()

Launcher of the application

Valeur de retour

mixed

Exceptions

RouterException

void disablePoweredByMention()

Allows you to enable writing the X-Powered-By header in the answer of the inquiry.

Valeur de retour

void

Application rest(string $url, string|array $controller_name, array $where = [])

Make the REST API base on route and ressource controller.

Paramètres

string $url
string|array $controller_name
array $where

Valeur de retour

Application

Exceptions

ApplicationException

void abort($code = 500, $message = '', array $headers = [])

Abort application

Paramètres

$code
$message
array $headers

Valeur de retour

void

Exceptions

HttpException

Capsule|mixed container(null $name = null, callable $callable = null)

Build dependance

Paramètres

null $name
callable $callable

Valeur de retour

Capsule|mixed

Exceptions

ApplicationException

Capsule __invoke(array ...$params)

__invoke

This point method on the container system

Paramètres

array ...$params

Valeur de retour

Capsule

Exceptions

ApplicationException