-
Notifications
You must be signed in to change notification settings - Fork 0
Module Annotations
AzCraft edited this page Mar 5, 2023
·
2 revisions
Module annotations are method attributes used to map methods called request handlers.
They follow the format #[RequestMethod("uri")] and
reside inside the RequestMethods directory.
The currently available module annotations are:
-
StartUp(string $path = "/")specifies that a method has to run before other methods in the same module. -
GET|POST|PUT|DELETE(string $path = "/")specifying the HTTP request method and path handled by this request handler. -
Fallback(string $path = "/")specifying fallback request handlers.
All request handlers take a single Request object as parameter and return one of The RequestResponse Classes.
Methods annotated with StartUp take the same argument
and don't have to return anything.
All startup methods that are assigned to the current request path or part of it get called before the request handler but only the closest fallback request handler can substitute the targetted request handler.
This is why it is recommended to have a Fallback request
handler for the root path /.
Related pages: