Starting from Laravel 11, every Laravel application includes a built-in `/up` route that provides a simple way to check the health of your application. This route helps determine whether your application is responsive and performing well.
The /up route requires no installation or configuration—it's available out of the box in any Laravel project. You can access it by visiting: https://your-laravel-app.com/up
When you visit the /up route, your Laravel application will return a "200 OK" status if it has booted successfully without any exceptions.
If an exception occurs during the application's boot process, Laravel will return a "500 Internal Server Error" instead. This makes it easy to monitor whether your application is running smoothly.
If you prefer a different endpoint instead of /up, you can customize it in your "bootstrap/app.php" file:
->withRouting( web: __DIR__.'/../routes/web.php', commands: __DIR__.'/../routes/console.php', health: '/up', )
Simply change '/up' to any other route you prefer.
When a request is made to the /up route, Laravel dispatches the Illuminate\Foundation\Events\DiagnosingHealth event. You can create an event listener to perform additional health checks, such as verifying database connectivity or other system dependencies.
If your listener throws an exception, Laravel will return a "500" status code for the /up route, indicating a failed health check.
This makes Laravel's /up route a flexible and extensible solution for monitoring application health.