Skip to content

0.2.2

Compare
Choose a tag to compare
@BenMorel BenMorel released this 22 Mar 11:21
· 121 commits to master since this release

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.