2017 © Pedro Peláez
 

library http-health-check

Simple HTTP health check written in PHP

image

jesugmz/http-health-check

Simple HTTP health check written in PHP

  • Friday, July 20, 2018
  • by jesugmz
  • Repository
  • 1 Watchers
  • 0 Stars
  • 0 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

HTTP Health Check

Minimum PHP Version CircleCI, (*1)

HTTP Health Check is a simple HTTP health check written in PHP built on top of Guzzle., (*2)

  • Easy way to check HTTP services status by status code and body content from your PHP application
  • Grant finite HTTP request timeout (Guzzle does not)
  • Positive behavior by default. If no conditions are provided, the health will be consider healthy as soon as the request can be made successfully - no connectivity issues

Installation

Install the latest version through Composer:, (*3)

$ composer require jesugmz/http-health-check

Usage

HTTP Health Check will do a GET request to the given endpoint URL and can check the following conditions in the response:, (*4)

  • HTTP status code: expressed as status_code_equals_to
  • Body content: plain text that appears in the body response and is expressed as body_contains
use HttpHealthCheck\HttpHealthCheck;

$endpointUrl = 'https://github.com/jesuGMZ/';
$conditions = [
    'status_code_equals_to' => 200,
    'body_contains'         => 'jesuGMZ',
];

$check = new HttpHealthCheck($endpointUrl, $conditions);

var_dump($check->isHealthy());

It allows also Guzzle Request Options parameters:, (*5)

use HttpHealthCheck\HttpHealthCheck;

$endpointUrl = 'https://mdn.github.io/learning-area/javascript/oojs/json/superheroes.json';
$conditions = [
    'status_code_equals_to' => 200,
    'body_contains'         => 'Super hero squad',
];
$options = [
    'headers' => [
        'User-Agent' => 'My custom user agent',
        'Accept'     => 'application/json',
    ]
];

$check = new HttpHealthCheck($endpointUrl, $conditions, $options);

var_dump($check->isHealthy());

The Versions

20/07 2018

dev-master

9999999-dev

Simple HTTP health check written in PHP

  Sources   Download

MIT

The Requires

 

The Development Requires

20/07 2018

v1.0.0

1.0.0.0

Simple HTTP health check written in PHP

  Sources   Download

MIT

The Requires

 

The Development Requires