PHPackages                             ueberdosis/laravel-docker-health-check - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. ueberdosis/laravel-docker-health-check

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

ueberdosis/laravel-docker-health-check
======================================

0.5.0(3mo ago)63.6k↓16.7%MITPHPPHP ^7.4|^8.0

Since Feb 4Pushed 3mo ago1 watchersCompare

[ Source](https://github.com/ueberdosis/laravel-docker-health-check)[ Packagist](https://packagist.org/packages/ueberdosis/laravel-docker-health-check)[ GitHub Sponsors](https://github.com/sponsors/ueberdosis/)[ RSS](/packages/ueberdosis-laravel-docker-health-check/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (5)Dependencies (1)Versions (7)Used By (0)

Laravel Docker Health Check
===========================

[](#laravel-docker-health-check)

[![](https://camo.githubusercontent.com/44687ef8da3a6944348a6f53a93bad6ea48d5e3597600caeb24da52647923302/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7565626572646f7369732f6c61726176656c2d646f636b65722d6865616c74682d636865636b2e737667)](https://packagist.org/packages/ueberdosis/laravel-docker-health-check)[![](https://camo.githubusercontent.com/cf313076dbba30b9c280f85087b1b250d3ff831aef83d548725309fdc82eaffb/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7565626572646f7369732f6c61726176656c2d646f636b65722d6865616c74682d636865636b2e737667)](https://packagist.org/packages/ueberdosis/laravel-docker-health-check)[![Sponsor](https://camo.githubusercontent.com/ee73cad5907779cdf16e865239ea623ca0bd44ccd5ad44fa7bfe7a5ac3ced298/68747470733a2f2f696d672e736869656c64732e696f2f7374617469632f76313f6c6162656c3d53706f6e736f72266d6573736167653d254532253944254134266c6f676f3d476974487562)](https://github.com/sponsors/ueberdosis)

A simple package that makes it easier to work with Laravel and Docker in production.

Installation
------------

[](#installation)

Install it with composer:

```
composer require ueberdosis/laravel-docker-health-check
```

Add the Middleware to your `app/Http/Kernel.php`:

```
class Kernel extends HttpKernel
{
    /**
     * The application's global HTTP middleware stack.
     *
     * These middleware are run during every request to your application.
     *
     * @var array
     */
    protected $middleware = [
        // ...
        \Ueberdosis\DockerHealthCheck\Middleware\ClearCacheOnInitialRequest::class,
    ];

    // ...
}
```

Update your health check script to curl the newly registered route `/docker-health-check`. The following is an example health check script, please update your own implementation:

```
#!/usr/bin/env bash
set -e

if [ $(curl -o /dev/null -L -s -w "%{http_code}\n" http://localhost/docker-health-check) = "200" ]; then
    exit 0
else
    exit 1
fi
```

What problem is this package solving?
-------------------------------------

[](#what-problem-is-this-package-solving)

When using Laravel with Docker in production you would normally write a huge entrypoint script that runs migrations, clears caches and so on. But clearing caches in this entrypoint script doesn't work well. Why?

Well, the orchestrator waits for the Laravel container to become healthy before directing actual traffic to it. So when you update your stack, the old container will handle all the traffic at the moment when you call `php artisan view:clear` in your entrypoint up to the moment when the new container is healthy. When traffic hits the site in that moment, the cache will be rebuilt in the old container.

This is a huge pain on big dockerized Laravel apps. This package will clear caches on the first request to a new container by using a temporary file in the app root.

And it conveniently registers a nice `/docker-health-check` route for you that returns a response with status code 200 for your health check script.

License
-------

[](#license)

MIT

###  Health Score

46

—

FairBetter than 93% of packages

Maintenance80

Actively maintained with recent releases

Popularity27

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

 Bus Factor2

2 contributors hold 50%+ of commits

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~455 days

Total

5

Last Release

104d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/3670ca0ea5e329d23070e3707db7bab7ab788a31fa16678507c0c14b858bcff5?d=identicon)[patrickbaber](/maintainers/patrickbaber)

![](https://www.gravatar.com/avatar/98f238189eab12ef0f354c0d9ec61f6c7f7c7e75564e3b3b0c79fed22396888b?d=identicon)[timoisik](/maintainers/timoisik)

---

Top Contributors

[![hanspagel](https://avatars.githubusercontent.com/u/1577992?v=4)](https://github.com/hanspagel "hanspagel (6 commits)")[![kriskbx](https://avatars.githubusercontent.com/u/3148865?v=4)](https://github.com/kriskbx "kriskbx (6 commits)")[![mkriegeskorte](https://avatars.githubusercontent.com/u/3955680?v=4)](https://github.com/mkriegeskorte "mkriegeskorte (2 commits)")[![timoisik](https://avatars.githubusercontent.com/u/9573441?v=4)](https://github.com/timoisik "timoisik (2 commits)")[![patrickbaber](https://avatars.githubusercontent.com/u/3321255?v=4)](https://github.com/patrickbaber "patrickbaber (1 commits)")

### Embed Badge

![Health badge](/badges/ueberdosis-laravel-docker-health-check/health.svg)

```
[![Health](https://phpackages.com/badges/ueberdosis-laravel-docker-health-check/health.svg)](https://phpackages.com/packages/ueberdosis-laravel-docker-health-check)
```

###  Alternatives

[barryvdh/laravel-ide-helper

Laravel IDE Helper, generates correct PHPDocs for all Facade classes, to improve auto-completion.

14.9k123.0M687](/packages/barryvdh-laravel-ide-helper)[orchestra/canvas

Code Generators for Laravel Applications and Packages

21017.2M158](/packages/orchestra-canvas)[illuminate/pipeline

The Illuminate Pipeline package.

9446.6M213](/packages/illuminate-pipeline)[illuminate/pagination

The Illuminate Pagination package.

10532.5M862](/packages/illuminate-pagination)[spatie/laravel-pjax

A pjax middleware for Laravel 5

513371.8k11](/packages/spatie-laravel-pjax)[spatie/laravel-mix-preload

Add preload and prefetch links based your Mix manifest

169176.0k2](/packages/spatie-laravel-mix-preload)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
