2017 © Pedro Peláez
 

library laravel-healthcheck

configurable healthcheck route for laravel

image

ipunkt/laravel-healthcheck

configurable healthcheck route for laravel

  • Wednesday, November 8, 2017
  • by svensp
  • Repository
  • 4 Watchers
  • 1 Stars
  • 1,737 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 7 Versions
  • 22 % Grown

The README.md

Laravel Health Check

Latest Stable Version Latest Unstable Version License Total Downloads, (*1)

configurable healthcheck route for laravel, (*2)

Install

composer require ipunkt/laravel-healthcheck

If you are using laravel 5.5 or above you do not have to add the provider manually. We support the package discovery., (*3)

Add the \Ipunkt\LaravelHealthcheck\HealthcheckProvider::class, to your providers section in config/app.php., (*4)

php artisan vendor:publish --provider "Ipunkt\LaravelHealthcheck\HealthcheckProvider"

Usage

Edit the config file config/healthcheck.php, (*5)

see the comments there for more information, (*6)

Available checkers

  • database Tests database connections via Eloquent
  • storage Tests write access to filesystem paths
  • redis Tests for accessing redis queue service
  • solr Tests for accessing solr services (needs extra package solarium/solarium)

Extend

To add a new Healthchecker implement Ipunkt\LaravelHealthcheck\HealthChecker\Checker and register it with the Ipunkt\LaravelHealthcheck\HealthChecker\Factory\HealthcheckerFactory. The HealtcheckerFactory is registered as singleton so you can use App::make() to retrieve it in the boot part of a ServiceProvider and register your Checker., (*7)

HealthcheckerFactory::register

  • string $identifier - the identifier which will activate the checker when added to config('healthcheck.checks')
  • Closure function(array $config) { return new Checker; } - Callback to make the Checker. Receives $config('healthcheck.$identifier') as parameter.

Example

class ServiceProvider {
    public function boot() {

        /**
         * @var HealthcheckerFactory $factory
         */
        $factory = $this->app->make('Ipunkt\LaravelHealthcheck\HealthChecker\Factory\HealthcheckerFactory');

        $factory->register('identifier', function(array $config) {

            $newChecker = new ExampleChecker;

            $newChecker->setExampleOption( array_get($config, 'url', 'http://www.example.com') );

            return $newChecker;

        });

    }
}

class ExampleChecker implement Ipunkt\LaravelHealthcheck\HealthChecker\Checker {

    protected $url;

    public function setExampleOption($url) {
        $this->url = $url;
    }

    public function check() {
        $url = $this->url;
        if ( @file_get_contents($url) === false )
            throw new CheckFailedException("Failed to retrieve $url.");
    }
}

The Versions

08/11 2017

dev-master

9999999-dev

configurable healthcheck route for laravel

  Sources   Download

MIT

The Requires

 

The Development Requires

by Sven Speckmaier

08/11 2017

1.2.2

1.2.2.0

configurable healthcheck route for laravel

  Sources   Download

MIT

The Requires

 

The Development Requires

by Sven Speckmaier

08/11 2017

1.2.1

1.2.1.0

configurable healthcheck route for laravel

  Sources   Download

MIT

The Requires

 

The Development Requires

by Sven Speckmaier

10/07 2017

1.2.0

1.2.0.0

configurable healthcheck route for laravel

  Sources   Download

MIT

The Requires

 

The Development Requires

by Sven Speckmaier

21/06 2017

1.1.0

1.1.0.0

configurable healthcheck route for laravel

  Sources   Download

MIT

The Requires

 

The Development Requires

by Sven Speckmaier

21/06 2017

dev-redis

dev-redis

configurable healthcheck route for laravel

  Sources   Download

MIT

The Requires

 

The Development Requires

by Sven Speckmaier

20/06 2017

1.0.0

1.0.0.0

configurable healthcheck route for laravel

  Sources   Download

MIT

The Requires

 

The Development Requires

by Sven Speckmaier