PHPackages                             cmdrsharp/hetrixtools-api - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. cmdrsharp/hetrixtools-api

ActiveLibr

cmdrsharp/hetrixtools-api
=========================

A wrapper for creating, updating and deleting HetrixTools Monitors.

2.0.0.0(8y ago)1251MITPHPPHP &gt;=7.1

Since Mar 29Pushed 8y ago3 watchersCompare

[ Source](https://github.com/CmdrSharp/hetrixtools-api)[ Packagist](https://packagist.org/packages/cmdrsharp/hetrixtools-api)[ RSS](/packages/cmdrsharp-hetrixtools-api/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (5)Dependencies (2)Versions (6)Used By (0)

About
=====

[](#about)

[![Latest Stable Version](https://camo.githubusercontent.com/e3e431a6e63637355e4b6f7d5b8fb08cda470f339bc8f953c948444f3ceb5065/68747470733a2f2f706f7365722e707567782e6f72672f636d647273686172702f686574726978746f6f6c732d6170692f762f737461626c65)](https://packagist.org/packages/cmdrsharp/hetrixtools-api)[![Build Status](https://camo.githubusercontent.com/aba0927c0b59ec58684a52b9cf0dd138bb51ba9483af2e810d7cce3c19db885e/68747470733a2f2f7472617669732d63692e6f72672f436d647253686172702f686574726978746f6f6c732d6170692e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/CmdrSharp/hetrixtools-api)[![StyleCI](https://camo.githubusercontent.com/d5787bd5f0ab4337512069d67bbc3ad85e56c698d9f3dc48fa22d29af62a06f5/68747470733a2f2f7374796c6563692e696f2f7265706f732f3132373136393230382f736869656c643f6272616e63683d6d6173746572)](https://styleci.io/repos/127169208)[![MIT licensed](https://camo.githubusercontent.com/7013272bd27ece47364536a221edb554cd69683b68a46fc0ee96881174c4214c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c75652e737667)](./LICENSE)

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
============

[](#requirements)

- PHP 7.1 or higher

Installation
============

[](#installation)

Via composer

```
$ composer require cmdrsharp/hetrixtools-api
```

Usage
=====

[](#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.

```
// Example Uptime Monitor creation (adding a ping monitor to 8.8.8.8)
use CmdrSharp\HetrixtoolsApi\Uptime\Factory as HetrixTools;

$monitor = new HetrixTools('myApiKey');

try {
	$result = $monitor->type('service')
	    ->name('Greatest Monitor')
	    ->target('8.8.8.8')
	    ->timeout(10)
	    ->frequency(1)
	    ->failsBeforeAlert(1)
	    ->public(false)
	    ->showTarget(false)
	    ->locations([
	        'dal' => true,
	        'msw' => true,
	        'nyc' => true
	    ])->create();
} catch(\Exception $e) {
	print($e->getMessage());
}

// Example Blacklist Monitor creation (adding a monitor to 192.168.0.0/24)
use CmdrSharp\HetrixtoolsApi\Blacklist\Factory as HetrixTools;

$monitor = new HetrixTools('myApiKey');

try {
	$result = $monitor->target('192.168.0.0/24')
	    ->label('Blacklist Monitor 1')
	    ->contact(1)
	    ->create();
} catch(\Exception $e) {
	print($e->getMessage());
}

// Example Listing Uptime Monitors
use CmdrSharp\HetrixtoolsApi\Uptime\Repository as HetrixTools;

$instance = new HetrixTools('myApiKey');

try {
	$result = $instance->listUptimeMonitors(); // Fetches 100 results
	$result = $instance->listUptimeMonitors(0, 50); // Page 0, 50 results per page.
} catch(\Exception $e) {
	print($e->getMessage());
}

// Example Blacklist Report
use CmdrSharp\HetrixtoolsApi\Blacklist\Repository as HetrixTools;

$instance = new HetrixTools('myApiKey');

try {
	$result = $instance->blacklistReport('8.8.8.8');
	$result = $instance->blacklistReport('8.8.8.8', '2018-03-29');
} catch(\Exception $e) {
	print($e->getMessage());
}
```

The client returns a normal PSR ResponseInterface. This means you interact with the response as you would with any Guzzle response.

```
$result->getStatusCode(); // 200
$result->getBody(); // {"status":"SUCCESS","monitor_id":"exampleMonitorId","action":"added"}
```

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.

```
// Example for modifying Uptime Monitors
try {
	// Changing the target, category and locations
	$result = $monitor->id('exampleMonitorId')
	    ->target('8.8.4.4')
	    ->category('My awesome monitor')
	    ->locations([
	        'dal' => true,
	        'msw' => true,
	        'nyc' => true,
	        'mos' => true
	    ])->patch();

	// Changing the name only.
	$result = $monitor->id('exampleMonitorId')
		->name('New awesome monitor')
		->patch();

} catch(\Exception $e) {
	print($e->getMessage());
}

// Example for modifying Blacklist Monitors
try {
	$result = $monitor->target('192.168.0.0/24')
	    ->label('Blacklist Monitor 113')
	    ->contact(5)
	    ->patch();
} catch(\Exception $e) {
	print($e->getMessage());
}
```

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](https://gist.github.com/hetrixtools/3789e032af9224be2cdf49e557a7d484).

Available methods
=================

[](#available-methods)

```
// Common Methods (for both Blacklist and Uptime)
create();
patch();
delete();
target(String $target);
listMonitors(?int $page = null, ?int $per_page = null);
listContacts();

// FACTORY: Uptime Monitoring Methods
id(String $id);
type(String $type);
name(String $name);
timeout(int $timeout);
frequency(int $frequency);
failsBeforeAlert(int $fails);
failedLocations(int $failed);
contactList(int $contactList);
category(String $category);
alertAfter(int $time);
repeatTimes(int $times);
repeatEvery(int $every);
public(bool $public);
showTarget(bool $show);
verify_ssl_certificate(bool $verify);
verify_ssl_host(bool $verify);
locations(array $locations);
keyword(String $keyword);
maxRedirects(int $redirects);
port(int $port);
checkAuth(bool $check);
smtpUser(String $user);
smtpPass(String $pass);

// REPOSITORY: Uptime Monitoring Methods
status();
uptimeReport(String $id);

// FACTORY: Blacklist Monitoring Methods
label(String $label);
contact(int $contact);

// REPOSITORY: Blacklist Monitoring Methods
blacklistReport(String $target, ?String $date = null);
manualCheck(String $target);
```

Errors
======

[](#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
==========

[](#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
==========

[](#versioning)

This package follows [Explicit Versioning](https://github.com/exadra37-versioning/explicit-versioning).

Authors
=======

[](#authors)

[CmdrSharp](https://github.com/CmdrSharp)

Credits
=======

[](#credits)

Many thanks to [HetrixTools](https://hetrixtools.com), a service I fully endorse and recommend everyone to use for their uptime and blacklist monitoring needs!

License
=======

[](#license)

[The MIT License (MIT)](LICENSE)

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 97% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

5

Last Release

2971d ago

Major Versions

1.0.0.0 → 2.0.0.0-alpha12018-03-29

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/5938745?v=4)[Marcus Frolander](/maintainers/CmdrSharp)[@CmdrSharp](https://github.com/CmdrSharp)

---

Top Contributors

[![CmdrSharp](https://avatars.githubusercontent.com/u/5938745?v=4)](https://github.com/CmdrSharp "CmdrSharp (32 commits)")[![scrutinizer-auto-fixer](https://avatars.githubusercontent.com/u/6253494?v=4)](https://github.com/scrutinizer-auto-fixer "scrutinizer-auto-fixer (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/cmdrsharp-hetrixtools-api/health.svg)

```
[![Health](https://phpackages.com/badges/cmdrsharp-hetrixtools-api/health.svg)](https://phpackages.com/packages/cmdrsharp-hetrixtools-api)
```

###  Alternatives

[neuron-core/neuron-ai

The PHP Agentic Framework.

1.8k245.3k21](/packages/neuron-core-neuron-ai)[tencentcloud/tencentcloud-sdk-php

TencentCloudApi php sdk

3731.2M42](/packages/tencentcloud-tencentcloud-sdk-php)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
