sgrodzicki / pingdom
A PHP library for dealing with the Pingdom REST API
Installs: 65 232
Dependents: 2
Suggesters: 0
Security: 0
Stars: 12
Watchers: 2
Forks: 10
Open Issues: 0
Requires
- php: >=5.3.3
- guzzle/guzzle: >=3.0, <4.0
This package is not auto-updated.
Last update: 2020-12-25 19:09:38 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
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