Cmd/Ctrl + K

Controllers

Controllers keep route files compact and make route caching possible.

Create a controller

Generate controllers in the conventional application directory.

Handler

Controller methods receive resolved dependencies and return response-compatible values.

Route

Register the controller method as the handler for an HTTP route.

Controllers are resolved through the container, so constructor dependencies may be type-hinted.

Route parameters and requests

Type-hint the request alongside named route parameters when the action needs both.

Route parameters are matched by parameter name. The current request may be type-hinted alongside route parameters.

Generated controllers

make:controller Admin/UserController creates nested controller directories under app/Controllers.