PHPackages                             glesys/butler-health - 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. glesys/butler-health

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

glesys/butler-health
====================

Glesys Butler Health package.

v0.6.3(1y ago)019.2k—0%1MITPHPPHP ^8.2CI passing

Since Sep 16Pushed 5mo ago9 watchersCompare

[ Source](https://github.com/glesys/butler-health)[ Packagist](https://packagist.org/packages/glesys/butler-health)[ RSS](/packages/glesys-butler-health/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (8)Versions (21)Used By (1)

🚧 **Not ready for production.**

Butler Health
=============

[](#butler-health)

Laravel package for returning application "health".

Getting Started
---------------

[](#getting-started)

```
composer require glesys/butler-health
php artisan vendor:publish --provider="Butler\Health\ServiceProvider" --tag=config
php artisan serve # visit http://localhost:8000/health
```

Route
-----

[](#route)

The default route is `/health` and is configured at `butler.health.route`. The endpoint will return data in JSON.

```
{
    "about": {
        "environment": {},
        "cache": {},
        "drivers": {},
        "butlerHealth": {
            "version": "0.1"
        },
    },
    "checks": [
        {
            "name": "Database",
            "slug": "database",
            "group": "core",
            "description": "Check all database connections.",
            "runtimeInMilliseconds": 10,
            "result": {
                "value": 1,
                "message": "Connected to all databases.",
                "state": "ok"
            }
        }
    ]
}
```

### Custom route

[](#custom-route)

Set `butler.health.route` to a falsy value to disable the default route. Then add your own route.

```
Route::get('/status', Butler\Health\Controller::class)->middleware('api');
```

Checks
------

[](#checks)

The package comes with some checks out of the box, see [checks](src/Checks).

Register the checks you want in `butler.health.checks`.

```
// config/butler.php
return [
    'health' => [
        // ...
        'checks' => [
            Butler\Health\Checks\Database::class,
            App\Health\MyCheck::class,
        ],
    ],
];
```

### Create a check

[](#create-a-check)

Extend `Butler\Health\Check` and add it to `butler.health.checks`, done.

Custom about information
------------------------

[](#custom-about-information)

You can push additional "about" information.

```
Butler\Health\Repository::add('environment', ['operatingSystem' => php_uname('s')]);

Butler\Health\Repository::add('environment', fn () => ['time' => time()]);
```

```
{
    "about": {
        "environment": {
            "operatingSystem": "Linux",
            "time": 1678100209
        },
        "cache": {},
        "drivers": {},
        "butlerHealth": {},
    },
    "checks": []
}
```

Heartbeats
----------

[](#heartbeats)

Configure `butler.health.heartbeat.url` and `butler.health.heartbeat.token` to enable.

```
heartbeat('foo bar'); // POST http://heartbeat.localhost/foo-bar/1

heartbeat('foo baz', 5); // POST http://heartbeat.localhost/foo-baz/5
```

### Log driver

[](#log-driver)

To prevent HTTP requests in local environment, set `butler.health.heartbeat.driver` to "log".

### Fake

[](#fake)

Instead of faking the laravel [Http client](https://laravel.com/docs/master/http-client) in your tests you can fake heartbeats, see example below.

```
public function test_something()
{
    Heartbeat::fake();

    // Assert that nothing was sent...
    Heartbeat::nothingSent();

    // Assert a heartbeat was not sent...
    Heartbeat::assertNotSent('foobar');

    heartbeat('foobar');

    // Assert 1 heartbeat was sent...
    Heartbeat::assertSentCount(1);

    // Assert a heartbeat was sent...
    Heartbeat::assertSent('foobar');
}
```

Testing
-------

[](#testing)

```
vendor/bin/phpunit
vendor/bin/pint --test
```

How To Contribute
-----------------

[](#how-to-contribute)

Development happens at GitHub; any typical workflow using Pull Requests are welcome. In the same spirit, we use the GitHub issue tracker for all reports (regardless of the nature of the report, feature request, bugs, etc.).

All changes are supposed to be covered by unit tests, if testing is impossible or very unpractical that warrants a discussion in the comments section of the pull request.

### Code standard

[](#code-standard)

As the library is intended for use in Laravel applications we encourage code standard to follow [upstream Laravel practices](https://laravel.com/docs/master/contributions#coding-style) - in short that would mean [PSR-2](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md) and [PSR-4](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-4-autoloader.md).

###  Health Score

44

—

FairBetter than 92% of packages

Maintenance61

Regular maintenance activity

Popularity26

Limited adoption so far

Community17

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 83.7% of commits — single point of failure

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 ~70 days

Total

20

Last Release

371d ago

PHP version history (4 changes)v0.1.0PHP ^8.0

v0.2.0PHP ^8.0.2

v0.4.0PHP ^8.1

v0.6.0PHP ^8.2

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/708205?v=4)[Christoffer Andersson](/maintainers/wecc)[@wecc](https://github.com/wecc)

![](https://avatars.githubusercontent.com/u/2156132?v=4)[Markus Lilienberg](/maintainers/ttrig)[@ttrig](https://github.com/ttrig)

---

Top Contributors

[![ttrig](https://avatars.githubusercontent.com/u/2156132?v=4)](https://github.com/ttrig "ttrig (41 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (4 commits)")[![wecc](https://avatars.githubusercontent.com/u/708205?v=4)](https://github.com/wecc "wecc (4 commits)")

###  Code Quality

TestsPHPUnit

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/glesys-butler-health/health.svg)

```
[![Health](https://phpackages.com/badges/glesys-butler-health/health.svg)](https://phpackages.com/packages/glesys-butler-health)
```

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3274.9M308](/packages/psalm-plugin-laravel)[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

9682.1M97](/packages/roots-acorn)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)[laravel/cashier-paddle

Cashier Paddle provides an expressive, fluent interface to Paddle's subscription billing services.

264778.4k3](/packages/laravel-cashier-paddle)[flarum/core

Delightfully simple forum software.

211.3M1.9k](/packages/flarum-core)[zonneplan/laravel-module-loader

Module loader for Laravel

24118.4k](/packages/zonneplan-laravel-module-loader)

PHPackages © 2026

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