PHPackages                             kwxs/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. [DevOps &amp; Deployment](/categories/devops)
4. /
5. kwxs/health

ActiveLibrary[DevOps &amp; Deployment](/categories/devops)

kwxs/health
===========

Laravel Server &amp; App Health Monitor and Notifier

v0.10.5(5y ago)0204BSD-3-ClausePHPPHP &gt;=7.0

Since Nov 28Pushed 5y agoCompare

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

READMEChangelogDependencies (9)Versions (45)Used By (0)

Health Monitor
==============

[](#health-monitor)

Laravel Server &amp; App Health Monitor and Notifier
----------------------------------------------------

[](#laravel-server--app-health-monitor-and-notifier)

[![Latest Stable Version](https://camo.githubusercontent.com/701e48d1a2d158af23ad84cb579190963bc79747ba0906218d7b4b103d2e3180/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f707261676d6172782f6865616c74682e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/pragmarx/health) [![License](https://camo.githubusercontent.com/a7d953c880516e66cbc40f3833498c010255e60ca0142114a22829dc66fe28e4/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4253445f335f436c617573652d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE) [![Downloads](https://camo.githubusercontent.com/46ecbb027822d6b50776145e5d683f0aeaef2b5a76289130d4f096298f397297/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f707261676d6172782f6865616c74682e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/pragmarx/health) [![Code Quality](https://camo.githubusercontent.com/18b76bdbf5a1c3d1194ac4264fd0f1a07aaa27d79bd4c740083221e3595a382c/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f616e746f6e696f7269626569726f2f6865616c74682e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/antonioribeiro/health/?branch=master) [![Build](https://camo.githubusercontent.com/807f4e27a2483432d362183f5980f7465813e160a4a74bc2838687d47d082ec9/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f6275696c642f672f616e746f6e696f7269626569726f2f6865616c74682e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/antonioribeiro/health/?branch=master) [![Build](https://camo.githubusercontent.com/9229c48b42536981e43c2f4803eab5759052b8082e602c1f121a2ad04cc7ad43/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f616e746f6e696f7269626569726f2f6865616c74682e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/antonioribeiro/health/?branch=master) [![StyleCI](https://camo.githubusercontent.com/d160e41b84e7dd9920b66f2cd4254bdbf8d96df3faa8dbe2f5f474432d53956f/68747470733a2f2f7374796c6563692e696f2f7265706f732f37343832393234342f736869656c64)](https://styleci.io/repos/74829244)

This package checks if the application resources are running as they should and creates a service status panel. It has the following main points:

- Highly extensible and configurable: you can create new checkers and notifiers very easily, and you can virtually change everything on it.
- Easy configuration: uses YAML as configuration files
- Resilient resource checker: if the framework is working and at least one notification channel, you should receive notification messages.
- Built-in notification system: get notifications via mail, slack, telegram or anything else you need.
- Routes for: panel, json result, string result and resource.
- Configurable panel design.
- Cache.
- Schedule checks to automatically receive notifications when a service fails.
- View app error messages right in the panel.
- Http response codes 200 and 500, on error, for services like [Envoyer](https://envoyer.io) to keep track of your app health.

Built-in Resources
------------------

[](#built-in-resources)

Heath has pre-configured resource checkers for the following services:

- AppKey
- Broadcasting
- Cache
- ConfigurationCached
- Database
- DebugMode
- DirectoryPermissions
- DiskSpace
- ElasticsearchConnectable
- EnvExists
- Filesystem
- Framework
- Horizon
- Http
- Https
- LaravelServices
- Latency
- LocalStorage
- Mail
- MailgunConnectable
- MemcachedConnectable
- MigrationsUpToDate
- MySql
- MySqlConnectable
- NewrelicDeamon
- NginxServer
- PackagesUpToDate
- Php
- PostgreSqlConnectable
- PostgreSqlServer
- Queue
- QueueWorkers
- RebootRequired
- Redis
- RedisConnectable
- RedisServer
- RoutesCached
- S3
- ServerLoad
- ServerUptime
- Sshd
- Supervisor

But you can add anything else you need, you just have to find the right checker to use or just create a new checker for your resource.

Easy Configuration
------------------

[](#easy-configuration)

Creating new resources monitors is easy, just create a new YAML file in app's config/health folder and it's done. Here's some examples:

### Amazon S3

[](#amazon-s3)

```
name: S3
abbreviation: s3
checker: PragmaRX\Health\Checkers\CloudStorageChecker
notify: true
driver: s3
file: pragmarx-health-s3-testfile.txt
contents: {{ str_random(32) }}
error_message: 'Amazon S3 connection is failing.'
column_size: 4

```

### Nginx

[](#nginx)

```
name: NginxServer
abbreviation: ngnxsrvr
checker: PragmaRX\Health\Checkers\ProcessChecker
command: 'pgrep %s'
method: process_count
process_name: nginx
instances:
    minimum:
        count: 4
        message: 'Process "%s" has not enough instances running: it has %s, when should have at least %s'
    maximum:
        count: 8
        message: 'Process "%s" exceeded the maximum number of running instances: it has %s, when should have at most %s'
notify: true
pid_file_missing_error_message: 'Process ID file is missing: %s.'
pid_file_missing_not_locked: 'Process ID file is not being used by any process: %s.'
column_size: 4

```

Screenshots
-----------

[](#screenshots)

### Panel

[](#panel)

[![default panel](docs/images/panel.png)](docs/images/panel.png)

### Panel alternate design

[](#panel-alternate-design)

If you have lots of services to check, you may change the default panel design to use less space:

[![default panel](docs/images/error-single-2-columns.png)](docs/images/error-single-2-columns.png)

### Panel in 4 columns layout

[](#panel-in-4-columns-layout)

[![default panel](docs/images/error-single-4-columns.png)](docs/images/error-single-4-columns.png)

### Error Messages

[](#error-messages)

Mouse over a failing resource and get instant access to the error message:

[![default panel](docs/images/error-hint.png)](docs/images/error-hint.png)

Click the resource button and you'll get an alert showing the error message:

[![default panel](docs/images/error-alert.png)](docs/images/error-alert.png)

### Slack Notification

[](#slack-notification)

Here's an example of notification sent via Slack:

[![default panel](docs/images/slack.png)](docs/images/slack.png)

Artisan Console Commands
------------------------

[](#artisan-console-commands)

### health:panel

[](#healthpanel)

Use the command `health:panel` to view the status of your services in console.

### health:check

[](#healthcheck)

Use the command `health:check` to check all your resources and send notifications on failures.

[![default panel](docs/images/console-panel.png)](docs/images/console-panel.png)

Routes
------

[](#routes)

After installing you will have access to the following routes:

### /health/panel

[](#healthpanel-1)

The main panel route.

### /health/check

[](#healthcheck-1)

Returns a json with everything the package knows about your services:

[![default panel](docs/images/json.png)](docs/images/json.png)

### /health/string

[](#healthstring)

Returns a string with status on all your services, useful when using other monitoring services:

```
hlthFAIL-dbFAIL-filesystemOK-frmwrkOK-httpOK-httpsOK-mailOK

```

### /health/resource/{name}

[](#healthresourcename)

Returns a json with information about a particular service:

[![default panel](docs/images/json-resource.png)](docs/images/json-resource.png)

Requirements
------------

[](#requirements)

- PHP 7.1+
- Laravel 5.6+

Installing
----------

[](#installing)

Use Composer to install it:

```
composer require pragmarx/health

```

Installing on Laravel
---------------------

[](#installing-on-laravel)

Add the Service Provider to your `config/app.php`:

```
PragmaRX\Health\ServiceProvider::class,

```

Publish config and views
------------------------

[](#publish-config-and-views)

```
php artisan vendor:publish --provider="PragmaRX\Health\ServiceProvider"

```

Hit The Health Panel
--------------------

[](#hit-the-health-panel)

```
http://yourdomain.com/health/panel

```

Configure All The Things
------------------------

[](#configure-all-the-things)

Almost everything is easily configurable in this package:

- Panel name
- Title and messages
- Resource checkers
- Slack icon
- Notification channels
- Template location
- Routes and prefixes
- Mail server
- Cache
- Scheduler

Configure binaries
------------------

[](#configure-binaries)

Some of the checkers need you to configure the proper binary path for the checker to work:

```
'services' => [
    'ping' => [
        'bin' => env('HEALTH_PING_BIN', '/sbin/ping'),
    ],

    'composer' => [
        'bin' => env('HEALTH_COMPOSER_BIN', 'composer'),
    ],
],

```

Allowing Slack Notifications
----------------------------

[](#allowing-slack-notifications)

To receive notifications via Slack, you'll have to setup [Incoming Webhooks](https://api.slack.com/incoming-webhooks) and add this method to your User model with your webhook:

```
/**
 * Route notifications for the Slack channel.
 *
 * @return string
 */
public function routeNotificationForSlack()
{
    return config('services.slack.webhook_url');
}

```

Cache
-----

[](#cache)

When Health result is cached, you can flush the cache to make it process all resources again by adding `?flush=true` to the url:

```
http://yourdomain.com/health/panel?flush=true

```

Events
------

[](#events)

If you prefer to build you own notifications systems, you can disable it and listen for the following event

```
PragmaRX\Health\Events\RaiseHealthIssue::class

```

Broadcasting Checker
--------------------

[](#broadcasting-checker)

Broadcasting checker is done via ping and pong system. The broadcast checker will ping your service, and it must pong back. Basically what you need to do is to call back a url with some data:

### Redis + Socket.io

[](#redis--socketio)

```
var request = require('request');
var server = require('http').Server();
var io = require('socket.io')(server);
var Redis = require('ioredis');
var redis = new Redis();

redis.subscribe('pragmarx-health-broadcasting-channel');

redis.on('message', function (channel, message) {
    message = JSON.parse(message);

    if (message.event == 'PragmaRX\\Health\\Events\\HealthPing') {
        request.get(message.data.callbackUrl + '?data=' + JSON.stringify(message.data));
    }
});

server.listen(3000);

```

### Pusher

[](#pusher)

```

        Pusher Test

            var pusher = new Pusher('YOUR-PUSHER-KEY', {
                encrypted: true
            });

            var channel = pusher.subscribe('pragmarx-health-broadcasting-channel');

            channel.bind('PragmaRX\\Health\\Events\\HealthPing', function(data) {
                var request = (new XMLHttpRequest());

                request.open("GET", data.callbackUrl + '?data=' + JSON.stringify(data));

                request.send();
            });

        Pusher waiting for events...

```

Programatically checking resources
----------------------------------

[](#programatically-checking-resources)

```
$generalHealthState = app('pragmarx.health')->checkResources();

// or

$databaseHealthy = app('pragmarx.health')->checkResource('database')->isHealthy();
```

Checking in artisan commands example:

```
Artisan::command('database:health', function () {
    app('pragmarx.health')->checkResource('database')->isHealthy()
        ? $this->info('database is healthy')
        : $this->info('database is in trouble')
    ;
})->describe('Check database health');

```

Lumen
-----

[](#lumen)

To use it on Lumen, you'll probably need to do something like this on your `bootstrap/app.php`:

```
$app->instance('path.config', app()->basePath() . DIRECTORY_SEPARATOR . 'config');
$app->instance('path.storage', app()->basePath() . DIRECTORY_SEPARATOR . 'storage');

$app->withFacades();

$app->singleton('Illuminate\Contracts\Routing\ResponseFactory', function ($app) {
    return new \Illuminate\Routing\ResponseFactory(
        $app['Illuminate\Contracts\View\Factory'],
        $app['Illuminate\Routing\Redirector']
    );
});

$app->register(PragmaRX\Health\ServiceProvider::class);

```

Testing
-------

[](#testing)

```
$ composer test
```

Author
------

[](#author)

[Antonio Carlos Ribeiro](http://twitter.com/iantonioribeiro)

License
-------

[](#license)

Health is licensed under the BSD 3-Clause License - see the `LICENSE` file for details

Contributing
------------

[](#contributing)

Pull requests and issues are more than welcome.

###  Health Score

29

—

LowBetter than 60% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community18

Small or concentrated contributor base

Maturity61

Established project with proven stability

 Bus Factor1

Top contributor holds 93.1% 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 ~32 days

Recently: every ~74 days

Total

42

Last Release

2132d ago

PHP version history (2 changes)v0.1.0PHP &gt;=5.6.0

v0.4.0PHP &gt;=7.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/413b481f92caa1d96de546c0417395b0ca178658d9f6ef195ae303a91d2765e5?d=identicon)[ivankolodii](/maintainers/ivankolodii)

![](https://www.gravatar.com/avatar/f8e4d651b6994a06b201654d8f7835be0dead96022dd195e013e0bac9cf46e9b?d=identicon)[chris-kwx](/maintainers/chris-kwx)

---

Top Contributors

[![antonioribeiro](https://avatars.githubusercontent.com/u/3182864?v=4)](https://github.com/antonioribeiro "antonioribeiro (512 commits)")[![nope7777](https://avatars.githubusercontent.com/u/8977306?v=4)](https://github.com/nope7777 "nope7777 (8 commits)")[![marktopper](https://avatars.githubusercontent.com/u/2232539?v=4)](https://github.com/marktopper "marktopper (7 commits)")[![endigo-tc](https://avatars.githubusercontent.com/u/35096471?v=4)](https://github.com/endigo-tc "endigo-tc (5 commits)")[![iGusev](https://avatars.githubusercontent.com/u/1555767?v=4)](https://github.com/iGusev "iGusev (3 commits)")[![Omranic](https://avatars.githubusercontent.com/u/406705?v=4)](https://github.com/Omranic "Omranic (2 commits)")[![hilgroth](https://avatars.githubusercontent.com/u/828238?v=4)](https://github.com/hilgroth "hilgroth (1 commits)")[![igorbabko](https://avatars.githubusercontent.com/u/9337772?v=4)](https://github.com/igorbabko "igorbabko (1 commits)")[![ivankolodii](https://avatars.githubusercontent.com/u/35073476?v=4)](https://github.com/ivankolodii "ivankolodii (1 commits)")[![madisn](https://avatars.githubusercontent.com/u/2785788?v=4)](https://github.com/madisn "madisn (1 commits)")[![MNV](https://avatars.githubusercontent.com/u/3954352?v=4)](https://github.com/MNV "MNV (1 commits)")[![rap2hpoutre](https://avatars.githubusercontent.com/u/1575946?v=4)](https://github.com/rap2hpoutre "rap2hpoutre (1 commits)")[![0xflotus](https://avatars.githubusercontent.com/u/26602940?v=4)](https://github.com/0xflotus "0xflotus (1 commits)")[![samnela](https://avatars.githubusercontent.com/u/1852108?v=4)](https://github.com/samnela "samnela (1 commits)")[![assada](https://avatars.githubusercontent.com/u/1472664?v=4)](https://github.com/assada "assada (1 commits)")[![BrunIF](https://avatars.githubusercontent.com/u/490917?v=4)](https://github.com/BrunIF "BrunIF (1 commits)")[![caiquebb](https://avatars.githubusercontent.com/u/15231035?v=4)](https://github.com/caiquebb "caiquebb (1 commits)")[![dennie170](https://avatars.githubusercontent.com/u/6575697?v=4)](https://github.com/dennie170 "dennie170 (1 commits)")[![EricTendian](https://avatars.githubusercontent.com/u/498525?v=4)](https://github.com/EricTendian "EricTendian (1 commits)")

---

Tags

laravelhealthservernotificationsappmonitorpragmarxpanel

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[pragmarx/health

Laravel Server &amp; App Health Monitor and Notifier

2.0k1.0M2](/packages/pragmarx-health)[sarfraznawaz2005/servermonitor

Laravel package to periodically monitor the health of your server and website.

19513.2k1](/packages/sarfraznawaz2005-servermonitor)[timokoerber/laravel-one-time-operations

Run operations once after deployment - just like you do it with migrations!

6481.7M11](/packages/timokoerber-laravel-one-time-operations)[spatie/laravel-prometheus

Export Laravel metrics to Prometheus

2651.3M6](/packages/spatie-laravel-prometheus)[renoki-co/laravel-healthchecks

Laravel Healthchecks is a simple controller class that helps you build your own healthchecks endpoint without issues.

5654.9k](/packages/renoki-co-laravel-healthchecks)[thiagof/laravelrpc

JsonRPC Client/Server services for Laravel 5

337.5k](/packages/thiagof-laravelrpc)

PHPackages © 2026

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