meinestadt / ms-laravel-readiness
simple package to provide a readiness controller for drop-in use in projects running on k8s. tests each sql- connection and each redis connection for functionality.
Installs: 0
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
pkg:composer/meinestadt/ms-laravel-readiness
Requires
- php: >=8.0
- illuminate/database: >=9.0
- illuminate/http: >=9.0
- illuminate/redis: >=9.0
- illuminate/routing: >=9.0
- illuminate/support: >=9.0
This package is not auto-updated.
Last update: 2026-01-15 13:37:56 UTC
README
this class is to be used in laravel projects as a drop in readiness controller for k8s environments. it checks the connection for redis and sql to be working and active and send 503 if they are not, thus triggering the proper readiness-failed mechanisms of k8s. So this is a hardening thing.
install
to use this do the usual
composer install meinestadt/ms-laravel-readiness
configure
to be used in your application, you also need to setup the necessary route(s)
<?php
use Illuminate\Support\Facades\Route;
use Meinestadt\MsLaravelReadiness\ReadinessController;
use App\Http\Middleware\AuthenticateApiCalls;
/*
* other routes here
* ...
* ...
*/
# excluding session based middleware
# bonus simplified liveness route, to be used for startup and liveness checks
Route::withoutMiddleware([
AuthenticateApiCalls::class,
\App\Http\Middleware\EncryptCookies::class,
\Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
\Illuminate\Session\Middleware\StartSession::class,
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
\App\Http\Middleware\VerifyCsrfToken::class,
])->group(function () {
Route::get('/health/liveness', fn () => response()->json(['status' => 'ok']))->name('liveness');
Route::get('/health/readiness', ReadinessController::class)->name('readiness');
});