New

Just launched: Vueblocks, a brand-new search engine for Vue packages! Explore Vueblocks →

amazeeio/healthz-php

4,260 1
Install
composer require amazeeio/healthz-php
Latest Version:v0.0.7
Laravel:10
License:Apache-2.0
Last Updated:Nov 1, 2026
Links: GitHub  ·  Packagist
Maintainer: amazeeio

Healthz PHP

This is a simple PHP app used to determine the overall health of a site hosted on Lagoon.

As it stands, it relies on Lagoon conventions to determine which services are available and then checks if the services are up.

Configuration

This script should reside in a directory separate from the application that is being hosted. For instance, the convention is that a webapp is stored in /app - you could store Healthz-php in /healthz.

  location /lagoonhealthz {
    root /lagoonhealthz;
    rewrite ^/lagoonhealthz$ /lagoonhealthz/index.php;

    location ~* \.php(/|$) {
      include        /etc/nginx/fastcgi.conf;
      fastcgi_param  SCRIPT_NAME        /index.php;
      fastcgi_param  SCRIPT_FILENAME    /lagoonhealthz/index.php;
      fastcgi_pass   ${NGINX_FASTCGI_PASS:-php}:9000;
    }
  }

Adding this to your nginx configuration will reroute all incoming traffic on /healthz to our current script.

Setting failure response code

By default, we return an http 500 response code for any failed checks. This can be a potential problem for setups that involve negative caching of errors.

If you would like to have the system return something other than a 500, you can set the environment variable HEALTHZ_PHP_HTTP_FAIL_CODE with the return code.

Extending checks

Checks can be created by implementing AmazeeIO\Health\Check\CheckInterface which principally does two things.

First, it checks whether the check is actually applicable in the present environment. For example, to know whether it should be checking the status of the Solr service, the CheckSolr class will first check whether the environment variable SOLR_PORT is available. If the CheckInterface::appliesInEnvironment call to any particular check returns true that check will be registered to run.

Second, all applicable checks are required to return both a result and a status. The status returns one of STATUS_PASS STATUS_FAIL and STATUS_WARN - These three statuses really determine the health of the service under test. They're used to determine health of the overall system.

The status of the check as a whole is determined by the most negative applicable check's result. That is, if any one of the checks return a STATUS_FAIL, the entire check is considered to have failed. If any one check returns a STATUS_WARN, the entire system check is considered to be in a warning state.

When you have created your checks you register them in the checks.conf.php file.

Related Packages

laravel/pint

An opinionated code formatter for PHP.

214,519,084 3,170
tightenco/duster

Automatic configuration for Laravel apps to apply Tighten's standard linting & c...

3,496,815 603
directorytree/ldaprecord-laravel

LDAP Authentication & Management for Laravel.

2,986,160 574
realodix/haiku

A tool to manage and maintain Adblock filter lists.

1,274,894 3
hemp/presenter

Easy Model Presenters in Laravel

658,126 247

Version History

Version Released Laravel License
v0.0.7 ^10.0 Apache-2.0
v0.0.6 Apache-2.0
v0.0.5 Apache-2.0
v0.0.4 Apache-2.0
v0.0.3 Apache-2.0