PHPackages                             ilyagvc/checkhost - 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. ilyagvc/checkhost

ActiveLibrary

ilyagvc/checkhost
=================

PHP wrapper for check-host.net API

v1.2.3(9mo ago)7294—0%11MITPHPPHP &gt;=7.4

Since Jul 28Pushed 9mo ago1 watchersCompare

[ Source](https://github.com/ILYAGVC/CheckHostPHP)[ Packagist](https://packagist.org/packages/ilyagvc/checkhost)[ RSS](/packages/ilyagvc-checkhost/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (9)DependenciesVersions (10)Used By (1)

CheckHost PHP
=============

[](#checkhost-php)

**CheckHost PHP** is a lightweight PHP wrapper for interacting with the [check-host.net](https://check-host.net) API, allowing you to run PING, HTTP, TCP, UDP, DNS, TRACEROUTE checks from a variety of global nodes. It includes flexible country/node filtering and comprehensive result parsing.

---

✅ Features
----------

[](#-features)

- Get real-time availability data from multiple global nodes
- Supports: `ping`, `http`, `tcp`, `udp`, `dns`, `traceroute`
- Filter nodes by country code, country name, or domain
- Collect results from specific or all available nodes
- Parse and structure response data (avg/min/max ping, jitter, status, etc.)

---

📦 Installation
--------------

[](#-installation)

Install via [Composer](https://getcomposer.org/):

```
composer require ilyagvc/checkhost
```

---

🧱 Constructor
-------------

[](#-constructor)

```
$checkHost = new CheckHost(
    array|null $selectedCountries = null,
    bool $except = false,
    string|null $proxy = null,
    int $timeout = 60
);
```

### Parameters:

[](#parameters)

ParameterTypeDescription`$selectedCountries``array`, `null`Country name(s), ISO country code(s), or node domain(s) to include/exclude (`null` = all available nodes) (default = `null`)`$except``bool`If `true`, excludes the specified countries instead of including them (default = `false`)`$proxy``string`, `null`Optional proxy for curl requests (default = `null`)`$timeout``int`Request timeout (seconds) for waiting on test results (default = `60`)---

🔧 Methods
---------

[](#-methods)

### `setCountry(array|null $countries = null, bool $except = false): bool`

[](#setcountryarraynull-countries--null-bool-except--false-bool)

**Filters nodes based on country names, codes, or node domains.**

ParameterTypeDescription`$countries``array`, `null`Country name(s), ISO country code(s), or node domain(s) to include/exclude (`null` = all available nodes) (default = `null`)`$except``bool`If `true`, excludes the specified countries instead of including them (default = `false`)---

### `getNodes(): array`

[](#getnodes-array)

**Returns the currently selected and filtered node list.**
*No parameters.*

---

### `getNodesIp(): array|false`

[](#getnodesip-arrayfalse)

**Fetches the raw IP list of all available nodes from check-host.net.**
*No parameters.*

---

### `updateNodes(): bool`

[](#updatenodes-bool)

**Refreshes and re-applies node filters to fetch the latest node list.**
*No parameters.*

---

### `sendRequest(string $host, string $type, int $maxNodes = 0): string|false`

[](#sendrequeststring-host-string-type-int-maxnodes--0-stringfalse)

**Sends a check request of a given type to selected nodes.**

ParameterTypeDescription`$host``string`The target domain or IP to check`$type``string`Type of check: one of `ping`, `http`, `tcp`, `udp`, `dns`, `traceroute``$maxNodes``int`Maximum number of nodes to use. Any value other than `0` overrides the selected nodes and uses up to the specified number of available nodes (`0` = use selected nodes) (default = `0`)---

### `getResults(string $requestId): array|false`

[](#getresultsstring-requestid-arrayfalse)

**Fetches the result of a previously sent check request.**

ParameterTypeDescription`$requestId``string`ID returned by `sendRequest()`---

### `runCheck(string $host, string $type, int $maxNodes = 0): array|false`

[](#runcheckstring-host-string-type-int-maxnodes--0-arrayfalse)

**Combines `sendRequest()` and `getResults()` into a single call, returning structured data.**

ParameterTypeDescription`$host``string`The target domain or IP to check`$type``string`Type of check: one of `ping`, `http`, `tcp`, `udp`, `dns`, `traceroute``$maxNodes``int`Maximum number of nodes to use. Any value other than `0` overrides the selected nodes and uses up to the specified number of available nodes (`0` = use selected nodes) (default = `0`)---

### `fullCheck(string $host): array|false`

[](#fullcheckstring-host-arrayfalse)

**Performs all checks (`ping`, `http`, `tcp`, `udp`, `dns`, `traceroute`) on the given host.**

ParameterTypeDescription`$host``string`The target domain or IP to check---

### `setProxy(string $proxy): void`

[](#setproxystring-proxy-void)

**Sets or updates a proxy to be used for all cURL HTTP requests.**

ParameterTypeDescription`$proxy``string`Proxy address, e.g., `http://127.0.0.1:8080`---

### `setTimeout(int $seconds): void`

[](#settimeoutint-seconds-void)

**Sets the timeout for all result fetching requests.**

ParameterTypeDescription`$seconds``int`Timeout duration in seconds---

📦 Example Usage
---------------

[](#-example-usage)

### Ping Check

[](#ping-check)

```
