Controller Method Arguments

It is essential for any framework to be able to parameterize its routes and pass those parameters to the route handler.


Here is an example using a numeric id as part of the route. Our router pattern matches this and passes it as a required argument to the handler function (which in our case will be a controller method)

Route: /posts/{id}

Handler: function handler(int $id) {}

Complete and Continue  
Discussion

12 comments