Application
class Application extends Router (View source)
Properties
protected array | $error_code | Define the functions related to an http code executed if this code is up |
from Router |
protected array | $middlewares | Define the global middleware |
from Router |
protected string | $prefix | Define the routing prefix |
from Router |
protected string | $special_method | from Router | |
protected array | $current | Method Http current. |
from Router |
protected bool | $auto_csrf | Define the auto csrf check status. |
from Router |
static protected array | $routes | Route collection. |
from Router |
Methods
Set auto CSRF status Note: Disable only you run on test env
Allows to associate a global middleware on an route
Launch a callback function for each HTTP error code.
Match route de tout type de method
Get container
Check if is running on php cli
Launcher of the application
Allows you to enable writing the X-Powered-By header in the answer of the inquiry.
Make the REST API base on route and ressource controller.
Abort application
Build dependance
__invoke
Details
void
setBaseRoute(string $base_route)
Set the base route
void
setAutoCsrf(bool $auto_csrf)
Set auto CSRF status Note: Disable only you run on test env
Router
prefix(string $prefix, callable $cb)
Add a prefix on the roads
Router
middleware(array $middlewares)
Allows to associate a global middleware on an route
void
route(array $definition)
Route mapper
Router
any(string $path, callable|string|array $cb)
Add a route for
GET, POST, DELETE, PUT, OPTIONS, PATCH
Route
get(string $path, callable|string|array $cb)
Add a GET route
Route
post(string $path, callable|string|array $cb)
Add a POST route
Route
delete(string $path, callable|string|array $cb)
Add a DELETE route
Route
put(string $path, callable|string|array $cb)
Add a PUT route
Route
patch(string $path, callable|string|array $cb)
Add a PATCH route
Route
options(string $path, callable|string|array $cb)
Add a OPTIONS route
Router
code(int $code, callable|array|string $cb)
Launch a callback function for each HTTP error code.
When the define code match with response code.
Router
match(array $methods, string $path, callable|string|array $cb)
Match route de tout type de method
protected string
getSpecialMethod()
Retrieve the define special method
protected bool
hasSpecialMethod()
Check user define the special method
array
getRoutes()
Get the route collection
Capsule
getContainer()
Get container
void
bind(Loader $config)
Configuration Association
static Application
make(Request $request, Response $response)
Build the application
bool
isRunningOnCli()
Check if is running on php cli
bool|null
send()
Launcher of the application
void
disablePoweredByMention()
Allows you to enable writing the X-Powered-By header in the answer of the inquiry.
Application
rest(string $url, string|array $controller_name, array $where = [])
Make the REST API base on route and ressource controller.
void
abort(int $code = 500, string $message = '', array $headers = [])
Abort application
mixed
container(string|null $name = null, callable|null $callable = null)
Build dependance
mixed
__invoke(array ...$params)
__invoke
This point method on the container system