geocodio/uptimerobot-api-client

API client for the API of the UptimeRobot service

1.2.0 2021-08-25 07:07 UTC

This package is auto-updated.

Last update: 2024-04-25 14:06:56 UTC


README

Easily use the API of the website monitoring service UptimeRobot.

Requirements

This package requires PHP 7+ and uses cUrl.

Installation

This package can be used in any PHP project or with any framework. The packages is tested in PHP 7.0.

You can install the package via composer:

composer require vdhicts/uptimerobot-api-client

Usage

This package is just an easy client for using the UptimeRobot API. Please refer to the API documentation for more information about the requests.

Quick usage

use Vdhicts\UptimeRobot\Client;

// Load the configuration once, the URL is optional
$configuration = new Client\Configuration('API_KEY', 'OPTIONAL_API_URL');

// Start the client once
$client = new Client\Client($configuration);

// Perform the request, returns a string for further processing
$response = $client->perform('getMonitors', ['monitors' => '15830-32696-83920']);

Output formats

The UptimeRobot API support XML and JSON as output format, so does this client. This can be changed by the third parameter of the perform method of the client.

Exceptions

When something goes wrong, the client will throw an exception which extends the UptimeRobotClientException. If you want to catch exceptions from this package, that's the one you should catch. Error responses from the API aren't catched, so handle the response with some suspicion.

Contribution

Any contribution is welcome, but it should meet the PSR-2 standard and please create one pull request per feature. In exchange you will be credited as contributor on this page.

License

This package is open-sourced software licensed under the MIT license.

About vdhicts

Van der Heiden ICT services is the name of my personal company for which I work as freelancer. Van der Heiden ICT services develops and implements IT solutions for businesses and educational institutions.