The Router integrates FastRoutearrow-up-right and resolves handlers and middleware.
Router
Dispatches incoming requests
Resolves handlers like "BaseApp\\Controller\\UsersController@index"
"BaseApp\\Controller\\UsersController@index"
Binds route params to controller method arguments
Executes middleware chain before action
void dispatch()
"Namespace\\Class@method" → instantiate class and invoke method
"Namespace\\Class@method"
Return values:
array → sent as JSON
array
string/void → treated as already rendered
string
void
Each middleware must implement a handle(): bool method. If any returns false, the request is halted.
handle(): bool
false
Last updated 4 months ago
$router = new Router(); $router->dispatch();