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

acquaintsoft logo
Acquaint Softtech

Hire Laravel developers with AI expertise at $20/hr. Get started in 48 hours.

Visit Acquaint Softtech

The latest

View all →
CPX: The Composer Package Executor for PHP image

CPX: The Composer Package Executor for PHP

Read article
Laravel AI SDK Adds Human-in-the-Loop Tool Approval image

Laravel AI SDK Adds Human-in-the-Loop Tool Approval

Read article
Pest 5 Released With Test Impact Analysis, Agent Verification, and Evals image

Pest 5 Released With Test Impact Analysis, Agent Verification, and Evals

Read article
Queue-SQL: Run Mass Deletes and Updates Across Parallel Queue Jobs image

Queue-SQL: Run Mass Deletes and Updates Across Parallel Queue Jobs

Read article
Blade Formatting in Laravel Pint image

Blade Formatting in Laravel Pint

Read article
Inertia DevTools Is Now on the Chrome Web Store image

Inertia DevTools Is Now on the Chrome Web Store

Read article