configurable healthcheck route for laravel

1.3.1 2019-09-05 14:08 UTC

This package is auto-updated.

Last update: 2020-03-05 15:13:29 UTC


Latest Stable Version Latest Unstable Version License Total Downloads

configurable healthcheck route for laravel


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.

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

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


Edit the config file config/healthcheck.php

see the comments there for more information

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)


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.


  • 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.


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.");