sgrodzicki/pingdom

A PHP library for dealing with the Pingdom REST API

Installs: 46 848

Dependents: 0

Stars: 11

Watchers: 1

Forks: 5

Open Issues: 2

Language: PHP

1.1.5 2015-01-27 10:22 UTC

README

A PHP module to make use of the Pingdom REST API for you to automate your interaction with the Pingdom system.

Installation

The best way to install the library is by using Composer. Add the following to composer.json in the root of your project:

{ 
    "require": {
        "sgrodzicki/pingdom": "1.1.*"
    }
}

Then, on the command line:

curl -s http://getcomposer.org/installer | php
php composer.phar install

Use the generated vendor/.composer/autoload.php file to autoload the library classes.

Basic usage

<?php

$username = ''; // Pingdom username
$password = ''; // Pingdom password
$token    = ''; // Pingdom application key (32 characters)

$pingdom = new \Pingdom\Client($username, $password, $token);

// List of probe servers
$probes = $pingdom->getProbes();
foreach ($probes as $probe) {
    echo $probe->getName() . PHP_EOL;
}

// List of checks
$checks  = $pingdom->getChecks();
foreach ($checks as $check) {
    $results = $pingdom->getResults($check['id']);
}

Tests

Build Status

The client is tested with phpunit; you can run the tests, from the repository's root, by doing:

phpunit

Some tests require internet connection (to test against a real API response), so they are disabled by default; to run them add a credentials.php file in the root of your project:

<?php

require_once __DIR__ . '/vendor/autoload.php';

$username = '[your username]';
$password = '[your password]';
$token    = '[your token]';

and run the tests, from the repository's root, by doing:

phpunit --bootstrap credentials.php