ARouter  0.1.0
Annotation based router for your projects
Routes declaration

Controller annotation

Controller annotation used to say that class with this annotation is a Controller. Classes marked with this annotation will be scanned for Route annotations.

Route annotation

Route annotation is used for mapping web requests onto specific controller methods.

Here is an example of simple controller with mapping of 'contacts()' method to path '/contacts':

@Controller
class MyController {
@Route (path="/contacts", method="GET")
public function contacts() {
return new Response(200, [], "Contacts page");
}
}

If you do not specify "method" then GET will be used by default.

Path arguments

If annotation contains placeholders in "path" like

@Route (path="/user/{name}")
public function profile($name){}

then arguments named as those placeholders will be resolved to placeholder values.