2017 © Pedro Peláez
 

library uptime-checker

A php library to monitor website uptime

image

hedii/uptime-checker

A php library to monitor website uptime

  • Thursday, November 16, 2017
  • by hedii
  • Repository
  • 2 Watchers
  • 4 Stars
  • 36 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 9 % Grown

The README.md

Build Status, (*1)

Uptime Checker

A php library to monitor website uptime, (*2)

Table of contents

Installation

Install via composer, (*3)

composer require hedii/uptime-checker

Usage

Instantiation

Create a uptime checker instance:, (*4)

<?php

// require composer autoloader
require '/path/to/vendor/autoload.php';

// instantiate
$checker = new Hedii\UptimeChecker\UptimeChecker();

Alternatively, you can pass a GuzzleHttp\Client instance as a parameter if you want to set your own http client options (see Guzzle documentation):, (*5)

// instantiate with the http client as a parameter
$checker = new Hedii\UptimeChecker\UptimeChecker(new Client([
    'delay' => 1000,
    'allow_redirects' => false
]));

Perform an uptime check

Call the check($url) method with an url as a parameter to perform the uptime check., (*6)

$checker = new Hedii\UptimeChecker\UptimeChecker();
$result = $checker->check('http://example.com');

The result of this method is an array with with the check report information. The value of success indicates if the website is up or down:, (*7)

array(5) {
    'uri' => "http://example.com"
    'success' => true
    'status' => 200
    'message' => "OK"
    'transfer_time' => 0.765217
}

The result array

Field Type Description
uri string The url to test
success boolean Whether the uptime test is successful or not
status integer The http response status code
message string The http response message or the client error message
transfer_time float The transfer time in seconds

Testing

composer test

License

hedii/uptime-checker is released under the MIT Licence. See the bundled LICENSE file for details., (*8)

The Versions

16/11 2017

dev-master

9999999-dev

A php library to monitor website uptime

  Sources   Download

MIT

The Requires

 

The Development Requires

php hedii uptime-checker

02/09 2016

1.0.0

1.0.0.0

A php library to monitor website uptime

  Sources   Download

MIT

The Requires

 

The Development Requires

php hedii uptime-checker