How Laravel 11 Introduces a Built‑in Health Check Route (/up)

Laravel 11 adds a default health‑check endpoint accessible via the /up route, configured in bootstrap/app.php, which dispatches a DiagnosingHealth event and returns an animated "Application up" page to verify application status.

21CTO
21CTO
21CTO
How Laravel 11 Introduces a Built‑in Health Check Route (/up)

Laravel 11 adds a built‑in health‑check endpoint that can be accessed via the /up route.

The route is defined through the health‑check parameter in the new bootstrap/app.php configuration. By default Laravel configures it as follows:

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 the health route is registered, Laravel dispatches a DiagnosingHealth event. The default implementation returns a simple view that shows an animated “Application up” page.

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 endpoint can be accessed at /up and will display the health page in the browser.

Laravel 11 health check page
Laravel 11 health check page
Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

routingPHPhealth checkLaravelLaravel 11
21CTO
Written by

21CTO

21CTO (21CTO.com) offers developers community, training, and services, making it your go‑to learning and service platform.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.