-
-
Couldn't load subscription status.
- Fork 49
8. Custom Errors
İzni Burak Demirtaş edited this page Jan 23, 2022
·
1 revision
You can specify custom errors for Not Found and Exceptions Errors in PHP-Router.
For Not Found errors, you can use notFound method like this:
$router->notFound(function(Request $request, Response $response) {
// your codes.
});For Exception errors, you can use error method like this:
$router->error(function(Request $request, Response $response, Exception $exception) {
// your codes.
});You don't need to specify it. Because if you don't specify it, PHP-Router will be use default notFound and error behaviours.