ARouter
0.1.0
Annotation based router for your projects
|
Argument resolvers are designed to map data from incoming Request to controller method parameters using annotations.
CookieValue
Annotation allows to bind cookie value to method parameter.
You can see how method parameter $user is assigned to a $_COOKIE['user'] in next example:
If the name of cookie is different from argument name (e.g. $_COOKIE['user_value']) use next syntax:
RequestBody
annotation allows to bind a method parameter to the body of web request.
You can see how method parameter $json is assigned to a JSON web request body in next example:
RequestHeader
annotation allows to bind a method parameter to the request header.
You can see how method parameter $userAgent is assigned to a 'User-Agent' header in next example:
RequestParam
annotation allows to bind a method parameter to a web request parameter.
You can see how method parameter $page is assigned to a request parameter from 'example.com/list?page=2' URL in next example:
If the name of request parameter is different from method parameter name (example.com/list?pageNum=2) you can use next syntax:
If request parameter is a file you should typehint method parameter with UploadedFileInterface interface.
SessionAttribute
annotation allows to bind a session attribute to method parameter.
You can see how method parameter $user is assigned to a $_SESSION['user'] in next example:
If the name of session attribute is different from parameter name (e.g. $_SESSION['user_value']) use next syntax:
Method parameter of 'RequestInterface' type like
will be resolved to incoming HTTP Request object.