edwelker / pingdom

A PHP library for dealing with the Pingdom REST API

Home Page:http://www.pingdom.com/services/api/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Pingdom REST API

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)
$accountemail = ''; //Pingdom Account-Email (optional, for Team Accounts)

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

// 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]';

//Optional, see https://www.pingdom.com/resources/api/2.1#multi-user+authentication
$accountemail = '[your Team email account]';

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

phpunit --bootstrap credentials.php

About

A PHP library for dealing with the Pingdom REST API

http://www.pingdom.com/services/api/

License:MIT License


Languages

Language:PHP 100.0%