• Reading time ~ 1 min
  • 11.02.2024

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

Comments

No comments yet
Yurij Finiv

Yurij Finiv

Full stack

ABOUT

Professional Fullstack Developer with extensive experience in website and desktop application development. Proficient in a wide range of tools and technologies, including Bootstrap, Tailwind, HTML5, CSS3, PUG, JavaScript, Alpine.js, jQuery, PHP, MODX, and Node.js. Skilled in website development using Symfony, MODX, and Laravel. Experience: Contributed to the development and translation of MODX3 i...

About author CrazyBoy49z
WORK EXPERIENCE
Contact
Ukraine, Lutsk
+380979856297