GitXplorerGitXplorer
i

healthCheck

public
0 stars
0 forks
0 issues

Commits

List of commits on branch master.
Unverified
8e8d70122178a124478df4af676abbc5ef777eb5

fix bug

iicyxp committed 7 years ago
Unverified
6a49a11c1cc264d83fa69dbd175795be12f5bc84

adjust to array return

iicyxp committed 7 years ago
Unverified
3a011645f86d807a5db4c60a4f431b52a2be7f96

add to Arr

iicyxp committed 7 years ago
Unverified
048ba6cf5e732b4beb9a26d5c515e36a4e641d61

adjust readme & example

iicyxp committed 7 years ago
Unverified
937464566c1f61b9701db397150a3fb235a752e4

update readme

iicyxp committed 7 years ago
Unverified
04a2943d46ee6e086c0cbcdb9277b46b30eabbef

update composer.lock

iicyxp committed 7 years ago

README

The README file for this repository.

HealthCheck

Allows you to easily write healthchecks for your application and display a simple, aggregated report so you can quickly diagnose whether and why your app is having trouble (or whether you can blame someone else). You can also monitor your healthchecks with nagios, zabbix, etc.

Build Status

Wait, what's a healthcheck?

Healthchecks are a great way to test system health and connectivity to other services. For example, you can verify connectivity to memcache or mysql, that your app can read / write to certain files, or that your API key for a third-party service is still working.

Installation

You can install this into your project using composer. Create a composer.json file in the root of your project and add the following:

{
    "require": {
        "php": ">=5.4.0",
        "icyboy/health-check": "~1.0"
    }
}

Run composer install, include vendor/autoload.php, and you're off to the races!

Example Usage

Checks

use Icyboy\HealthCheck\HealthManager;
use Icyboy\HealthCheck\HealthException;

$hc = new HealthManager();

$hc->addCheck('info', function(){
    return "response extra message";
});

$hc->addCheck('pass', function() {
    return true;
});

$hc->addCheck('fail', function() {
    return false;
});

$config["version"] = 123;
$hc->addCheck('xxx', function() use ($config) {
    if ($config["version"] == "123") {
        return $config;
    } else {
        throw new HealthException("something was wrong");
    }
});

echo json_encode($hc->check());