0.2.2
New methods
RouteMatch::withClassParameters()
RouteMatch::withFunctionParameters()
These methods allow to create a copy of a RouteMatch
, with additional class/function parameters.
New annotation-based routing
Workflow:
- Add
@Route
annotations to controllers - Compile routes using
AnnotationRouteCompiler
- Cache the compiled routes and use them as input to
AnnotationRoute
Controllers support @Route
annotations on both classes & methods. @Route
annotations on classes are used as a prefix for @Route
annotations on methods.
Controllers support parameters, such as @Route("/book/{id}")
.
Parameters from @Route
on the controller class will be passed as parameters to the class constructor, and parameters from @Route
on the controller method will be passed as parameters to the method itself.