News

New Laravel 11 Apps Include a Health Check Endpoint

Published Updated
New Laravel 11 Apps Include a Health Check Endpoint image

As part of the release of Laravel 11, new applications include a health /up endpoint. This route is defined in the new bootstrap/app.php file by passing the health parameter—which is defined by default in the Laravel 11 skeleton:

Application::configure(basePath: dirname(__DIR__))
->withProviders()
->withRouting(
web: __DIR__.'/../routes/web.php',
// api: __DIR__.'/../routes/api.php',
commands: __DIR__.'/../routes/console.php',
// channels: __DIR__.'/../routes/channels.php',
+ health: '/up',
)
// ...

When setting up the application routing, the Laravel framework defines the health route and also emits a DiagnosingHealth event:

use Illuminate\Foundation\Events\DiagnosingHealth;
 
// ...
 
if (is_string($health)) {
Route::middleware('web')->get($health, function () {
Event::dispatch(new DiagnosingHealth);
 
return View::file(__DIR__.'/../resources/health-up.blade.php');
});
}

The route is configurable with the default /up endpoint and returns an animated “Application up” health page in the browser:

Laravel 11 health page
The Laravel 11 health page
Paul Redmond photo

Staff writer at Laravel News. Full stack web developer and author.

Sponsored

laravelcloud logo
Laravel Cloud

Easily create and manage your servers and deploy your Laravel applications in seconds.

Visit Laravel Cloud

The latest

View all →
Agent Run Observability in Laravel AI SDK 0.11 image

Agent Run Observability in Laravel AI SDK 0.11

Read article
Debounced Queued Event Listeners in Laravel image

Debounced Queued Event Listeners in Laravel

Read article
Statamic Mailables Viewer Previews Laravel Emails in the Control Panel image

Statamic Mailables Viewer Previews Laravel Emails in the Control Panel

Read article
Laravel Tackle: Run an AI Coding Agent in Your Laravel App image

Laravel Tackle: Run an AI Coding Agent in Your Laravel App

Read article
Queue::forward(): Reroute Laravel Queues in One Place image

Queue::forward(): Reroute Laravel Queues in One Place

Read article
Laravel Read-Through Filesystem: Lazy Storage Migration image

Laravel Read-Through Filesystem: Lazy Storage Migration

Read article