Download the PHP package cmdrsharp/hetrixtools-api without Composer
On this page you can find all versions of the php package cmdrsharp/hetrixtools-api. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download cmdrsharp/hetrixtools-api
More information about cmdrsharp/hetrixtools-api
Files in cmdrsharp/hetrixtools-api
Package hetrixtools-api
Short Description A wrapper for creating, updating and deleting HetrixTools Monitors.
License MIT
Informations about the package hetrixtools-api
About
This is an API for HetrixTools V2 API, aiming to make dealing with creating/updating/deleting/fetching Uptime and RBL Monitors easier and more fluent.
Requirements
- PHP 7.1 or higher
Installation
Via composer
Usage
Include the factory
or repository
that you need (either Uptime or Blacklist), then spawn up an instance of the class, supplying your API Key as the only argument. Finally, build out your request.
A full list of available methods for both the factories and repositories are available further down in this readme.
The client returns a normal PSR ResponseInterface. This means you interact with the response as you would with any Guzzle response.
Now that we have created a monitor, we may want to modify it. This is almost identical to the regular request. For Uptime Monitors, the ID field must be supplied. For Blacklist Monitors, the Target field is required. Apart from that, include what you want to change.
The CREATE
, PATCH
and DELETE
methods should always be at the end of the procedure call. All methods can be chained together. Some parameters are optional, and which ones are required will differ depending on what type of monitor you're creating. For a full overview of this, review the HetrixTools API Documentation.
Available methods
Errors
Upon receiving input that fails validation, a InvalidArgumentException
will be thrown. Upon receiving a response from the API which translates to an error, an ErrorException
is thrown.
It is therefore recommended to run the operations within a try/catch statement.
Test Suite
The included tests only verify that expected input/output to the interface work as intended. No tests are run toward the HetrixTools API itself, as this is currently not possible without making actual live changes.
Versioning
This package follows Explicit Versioning.
Authors
Credits
Many thanks to HetrixTools, a service I fully endorse and recommend everyone to use for their uptime and blacklist monitoring needs!
License
The MIT License (MIT)