PHPackages                             check-hostcc/check-host-api-php - 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. [Logging &amp; Monitoring](/categories/logging)
4. /
5. check-hostcc/check-host-api-php

ActiveLibrary[Logging &amp; Monitoring](/categories/logging)

check-hostcc/check-host-api-php
===============================

A lightweight, zero-dependency PHP 8.1+ wrapper for the Check-Host.cc API to perform global network diagnostics.

v1.0.0(1mo ago)01ISCPHPPHP ^8.1CI passing

Since May 12Pushed 1mo agoCompare

[ Source](https://github.com/Check-Host/php-lib)[ Packagist](https://packagist.org/packages/check-hostcc/check-host-api-php)[ Docs](https://check-host.cc)[ RSS](/packages/check-hostcc-check-host-api-php/feed)WikiDiscussions main Synced 3w ago

READMEChangelogDependenciesVersions (2)Used By (0)

Check-Host API PHP Library
==========================

[](#check-host-api-php-library)

A lightweight, lightning-fast, and feature-complete PHP 8+ wrapper for the [Check-Host.cc](https://check-host.cc) API. Full API reference: [check-host.cc/docs](https://check-host.cc/docs). A bundled OpenAPI 3.0.3 / Swagger spec ships at [`swagger.yaml`](./swagger.yaml) for codegen / offline browsing.

Seamlessly integrate global network diagnostics into your backend. Perform remote Ping, MTR, DNS, HTTP, TCP and UDP checks from multiple worldwide locations—straight from your PHP application. Checks from 60+ locations worldwide.

Features
--------

[](#features)

- **Zero Dependencies:** Built purely on the native PHP cURL extension. No Guzzle, no Symfony HTTP Client, zero package bloat.
- **Bulletproof Payloads:** Strictly utilizes POST requests for all active monitoring endpoints. This completely eliminates nasty URL-encoding issues with complex hostnames or custom UDP payloads.
- **Modern &amp; Clean:** Written for PHP 8.1+ with full type hinting and clean structure.
- **Smart Authentication:** API Key auto-injection. Configure your key once during initialization, and the core SDK seamlessly handles all authentication payloads under the hood.

Requirements
------------

[](#requirements)

- **PHP**: ^8.1
- `ext-curl` and `ext-json`

Installation
------------

[](#installation)

Ensure you have PHP 8.1+ installed. You can install the package directly from Packagist using Composer:

```
composer require check-hostcc/check-host-api-php
```

### Manual Installation

[](#manual-installation)

If you prefer not to use Composer, you can download the source code and require the class files directly:

```
require_once '/path/to/src/Exceptions/CheckHostException.php';
require_once '/path/to/src/CheckHost.php';
```

Quickstart
----------

[](#quickstart)

```
require 'vendor/autoload.php';

use CheckHostCc\CheckHostApi\CheckHost;

// Initialize the client. The API Key is optional.
// Without an API key, standard public rate limits apply.
// $checkHost = new CheckHost('YOUR_API_KEY_HERE');
// Or leave empty: new CheckHost()
$checkHost = new CheckHost();

// Example: Retrieve all current nodes
$locations = $checkHost->locations();
print_r($locations);
```

---

Complete API Reference &amp; Examples
-------------------------------------

[](#complete-api-reference--examples)

This library supports both minimal invocations and detailed, options-rich requests for every endpoint. All failures (network issues, API errors, rate limits) throw a `CheckHostException`.

### Common Options Used in Examples

[](#common-options-used-in-examples)

- `region`: Array of Nodes or ISO Country Codes (e.g. `['DE', 'NL']`) or Continents (e.g. `['EU']`).
- `repeatchecks`: Number of repeated probes to perform per node for higher accuracy (Live Check).
- `timeout`: Connection timeout threshold in seconds. Supported by methods where a timeout is applicable (e.g., HTTP, TCP).

---

### Information &amp; Utilities

[](#information--utilities)

#### Get My IP

[](#get-my-ip)

Returns the requesting client's public IPv4 or IPv6 address.

```
$ip = $checkHost->myip();
```

#### Get Locations

[](#get-locations)

Fetches a dynamic list of all currently active monitoring nodes across the globe.

```
$nodes = $checkHost->locations();
```

#### Host Info (GeoIP/ASN)

[](#host-info-geoipasn)

Retrieves detailed geolocation data, ISP information, and ASN details.

```
// Minimal Example
$info = $checkHost->info('check-host.cc');
```

#### WHOIS Lookup

[](#whois-lookup)

Performs a WHOIS registry lookup.

```
// Minimal Example
$whois = $checkHost->whois('check-host.cc');
```

---

### Active Monitoring (POST Tasks)

[](#active-monitoring-post-tasks)

Monitoring endpoints initiate tasks asynchronously and return a `Task Object` array containing an `uuid`. Use the `report()` method (documented below) to fetch the actual results.

#### Ping

[](#ping)

Dispatches ICMP echo requests to the target from global nodes.

```
// Minimal Example
$pingMin = $checkHost->ping('8.8.8.8');

// Max Example (With options)
$pingMax = $checkHost->ping('8.8.8.8', [
    'region' => ['DE', 'NL'],
    'repeatchecks' => 5,
    'timeout' => 5
]);
```

#### DNS

[](#dns)

Queries global nameservers for specific DNS records.

```
// Minimal Example
$dnsMin = $checkHost->dns('check-host.cc');

// Max Example (With options - TXT Record)
$dnsMax = $checkHost->dns('check-host.cc', [
    'querymethod' => 'TXT', // A, AAAA, MX, TXT, SRV, etc.
    'region' => ['US', 'DE']
]);
```

#### TCP

[](#tcp)

Attempts to establish a 3-way TCP handshake on a specific destination port.

```
// Minimal Example (Target, Port)
$tcpMin = $checkHost->tcp('1.1.1.1', 443);

// Max Example (With options)
$tcpMax = $checkHost->tcp('1.1.1.1', 80, [
    'region' => ['DE', 'NL'],
    'repeatchecks' => 3,
    'timeout' => 10
]);
```

#### UDP

[](#udp)

Sends UDP packets to a specified target and port.

```
// Minimal Example (Target, Port)
$udpMin = $checkHost->udp('1.1.1.1', 53);

// Max Example (With custom hex payload and options)
$udpMax = $checkHost->udp('1.1.1.1', 123, [
    'payload' => '0b', // NTP Request Hex
    'region' => ['EU'],
    'repeatchecks' => 2,
    'timeout' => 5
]);
```

#### HTTP

[](#http)

Executes an HTTP/HTTPS request to the target to measure TTFB and latency.

```
// Minimal Example
$httpMin = $checkHost->http('https://check-host.cc');

// Max Example (With options)
$httpMax = $checkHost->http('https://check-host.cc', [
    'region' => ['US', 'DE'],
    'repeatchecks' => 3,
    'timeout' => 10
]);
```

#### MTR

[](#mtr)

Initiates an MTR (My Traceroute) diagnostic.

```
// Minimal Example
$mtrMin = $checkHost->mtr('1.1.1.1');

// Max Example (With protocols, IP forced, and options)
$mtrMax = $checkHost->mtr('1.1.1.1', [
    'repeatchecks' => 15,
    'forceIPversion' => 4,     // 4 or 6
    'forceProtocol' => 'TCP',  // default is ICMP
    'region' => ['DE', 'US']
]);
```

---

### Fetching Results

[](#fetching-results)

#### Report

[](#report)

Fetches the compiled report and real-time statuses from a previously initiated monitoring check (Ping, TCP, HTTP, etc.) using its unique `uuid`. Wait 1-2 seconds after starting a check before polling. Longer checks with multiple repeats take one check per second and can be requested multiple times.

```
// The check UUID is returned by any monitoring method above
$taskUuid = 'c0b4b0e3-aed7-4ae2-9f53-7bac879697cb';

// Fetch the result payload
$report = $checkHost->report($taskUuid);
```

License
-------

[](#license)

ISC License

###  Health Score

37

—

LowBetter than 81% of packages

Maintenance91

Actively maintained with recent releases

Popularity1

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity42

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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

Unknown

Total

1

Last Release

42d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/325b57d0a107ee4f44d249701e3d75bb7680fbf4465a5c4d4fa9882063114a99?d=identicon)[Check-Host](/maintainers/Check-Host)

---

Top Contributors

[![Check-Host](https://avatars.githubusercontent.com/u/264288523?v=4)](https://github.com/Check-Host "Check-Host (11 commits)")

---

Tags

apicheck-hostdiagnosticsdnshttpmonitoringmtrnetworkphppingsdktcpudpwhoismonitoringapi clientpinguptimedns lookupmtrcheck-hostnetwork-diagnostics

### Embed Badge

![Health badge](/badges/check-hostcc-check-host-api-php/health.svg)

```
[![Health](https://phpackages.com/badges/check-hostcc-check-host-api-php/health.svg)](https://phpackages.com/packages/check-hostcc-check-host-api-php)
```

###  Alternatives

[datadog/php-datadogstatsd

An extremely simple PHP datadogstatsd client

19026.4M15](/packages/datadog-php-datadogstatsd)[ohdearapp/ohdear-cli

A standalone CLI tool for Oh Dear monitoring.

1401.3k](/packages/ohdearapp-ohdear-cli)[ohdearapp/laravel-ohdear-webhooks

Handle Oh Dear webhook calls in a Laravel app

2226.0k3](/packages/ohdearapp-laravel-ohdear-webhooks)

PHPackages © 2026

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