Download the PHP package saberyjs/tp5-route-helper without Composer
On this page you can find all versions of the php package saberyjs/tp5-route-helper. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download saberyjs/tp5-route-helper
More information about saberyjs/tp5-route-helper
Files in saberyjs/tp5-route-helper
Package tp5-route-helper
Short Description this library can helper to build tp5 route rule
License MIT
Informations about the package tp5-route-helper
thinkphp5-route-helper
this library help register route auto, write less,make develop better
introduce
if you have ever use thinkphp5 route ,you will feel exhausted ,because if you want register route rule,you must provide it in a file called route.php (maybe call some other name), so i write this tool,its his role like JAVA web route.
how to use
it is very easy to use this library.
- create object of RouterHelper
- call method called register
code is here:
what you need is create a instance of RouterHelper,and call register method on it
how to define class or method
to use this library ,you must provide some annotation when you write your controller, assuming we want write a controller class called User:
code is very simple,the annotation of getOrder explain that this method should request by GET or POST, and http protocal should be https,last,param id should only be number(max length is 4),if you do not remember thinkphp5 route ,you should read it first.
some tips
when you create RouteHelper,you can provide two args,$namespace and Parser,$namespace specify base namespace,but you may not provide because library provide a default value(app,it`s value is equal APP_NAMESPACE constant). $parser is a obejct that implement Parser interface,more detail,please look for AnnotationHeper,it is responsible for parse annotation for php code.
cache routes
in production environment,route rules is cached,actually,it depends on a config item called app_debug,if it`s value is equal to false,rules will be cached in the path(RUNTIME_PATH/routes.json).
contact
email:[email protected] QQ:1174332406
All versions of tp5-route-helper with dependencies
saberyjs/annotation Version ^1
saberyjs/exception Version ^1
saberyjs/refl-helper Version ^2