Add ledge-laravel to a Laravel app and connect it to Ledge.
The ledge-laravel package gives Ledge a secured health endpoint in your app, with checks for the queue, scheduler, Horizon, storage and more. It has no migrations and adds no tables.
sodium and zlib extensionscomposer require ledgehq/ledge-laravelThe service provider and the Ledge facade register themselves.
php artisan ledge:generate-keyThis writes a random 32-character key to your .env as LEDGE_SECRET_KEY and prints it. Running it again replaces the key, so you'll need to update Ledge if you do.
To print a key without touching .env, for example to paste into Forge, Vapor or Laravel Cloud, use --show:
php artisan ledge:generate-key --showIn Ledge, add the app and enter:
/_ledge/health, for example https://app.example.com/_ledge/health.LEDGE_SECRET_KEY value from the previous step.If you cache routes in production, run php artisan route:cache again after installing so the Ledge routes are included.
curl -H "X-Ledge-Key: $LEDGE_SECRET_KEY" https://app.example.com/_ledge/health| Response | What it means |
|---|---|
200 | The app is healthy or degraded. |
503 | At least one check is unhealthy. The body says which. |
401 with Unauthorized | The key doesn't match LEDGE_SECRET_KEY in the app. |
401 with LEDGE_SECRET_KEY is not configured | The app has no key set. |
The Ledge routes sit outside the web and api middleware groups, so sessions, CSRF and rate limiting don't apply to them. Only the key check does.
If the app is behind Cloudflare, see Sites behind Cloudflare.
Two checks rely on Laravel's scheduler:
schedule:run and reports Degraded if none has finished in the last 10 minutes.If the app already runs the scheduler from cron, there's nothing to add. To fill in the packages check straight away, run it once by hand:
php artisan ledge:packages:refreshBackups are off by default. Turn them on with:
LEDGE_ACQUIRE_ENABLED=trueThe app also needs:
database or redis. Backups run as a queued job, and on the sync driver a backup of any size times out.mysqldump, mariadb-dump, pg_dump or sqlite3.See Security for how backups are protected, and Configuration for the related settings.