PHPackages                             hydrawiki/ping - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. hydrawiki/ping

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

hydrawiki/ping
==============

A PHP class to ping hosts.

1.1.2(9y ago)0522MITPHP

Since Jan 31Pushed 9y ago1 watchersCompare

[ Source](https://github.com/HydraWiki/Ping)[ Packagist](https://packagist.org/packages/hydrawiki/ping)[ RSS](/packages/hydrawiki-ping/feed)WikiDiscussions master Synced yesterday

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

Ping
====

[](#ping)

A PHP class to ping hosts.

There are a ton of different methods of pinging a server using PHP, and I've found most to be poorly documented or downright dangerous in their implementation.

Therefore, I've created this simple class, which incorporates the three most popular ping methods (`exec()` with the system's `ping` utility, `fsockopen()`, and `socket_create()`). Each method has it's benefits and drawbacks, and may work better or worse on a particular system.

Ping was created by [Jeff Geerling](http://www.lifeisaprayer.com/) of [Midwestern Mac, LLC](http://www.midwesternmac.com/) in 2012.

Usage
-----

[](#usage)

This is a very simple class. Just create an instance, and run `ping()`.

```
$host = 'www.example.com';
$ping = new Ping($host);
$latency = $ping->ping();
if ($latency !== false) {
  print 'Latency is ' . $latency . ' ms';
}
else {
  print 'Host could not be reached.';
}
```

You can also specify the ttl (maximum hops) and timeout when creating the instance:

```
$ttl = 128;
$timeout = 5;
$ping = new Ping($host, $ttl, $timeout);
```

...or using the `setTtl()` or `setTimeout()` methods:

```
$ping = new Ping($host);
$ping->setTtl(128);
$ping->setTimeout(5);
```

You can change the host using the `setHost()` method:

```
$ping = new Ping($host);
...
$ping->setHost('www.anotherexample.com');
```

License
-------

[](#license)

Imap is licensed under the MIT (Expat) license. See included LICENSE.md.

###  Health Score

31

—

LowBetter than 66% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity68

Established project with proven stability

 Bus Factor1

Top contributor holds 77.1% 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 ~128 days

Recently: every ~102 days

Total

8

Last Release

3634d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/248632?v=4)[Alexia](/maintainers/Alexia)[@Alexia](https://github.com/Alexia)

![](https://avatars.githubusercontent.com/u/1508761?v=4)[Samuel Hilson](/maintainers/valeryan)[@valeryan](https://github.com/valeryan)

---

Top Contributors

[![geerlingguy](https://avatars.githubusercontent.com/u/481677?v=4)](https://github.com/geerlingguy "geerlingguy (37 commits)")[![Alexia](https://avatars.githubusercontent.com/u/248632?v=4)](https://github.com/Alexia "Alexia (4 commits)")[![strongwazz](https://avatars.githubusercontent.com/u/911315?v=4)](https://github.com/strongwazz "strongwazz (3 commits)")[![sergiowww](https://avatars.githubusercontent.com/u/8181382?v=4)](https://github.com/sergiowww "sergiowww (2 commits)")[![adduc](https://avatars.githubusercontent.com/u/44527?v=4)](https://github.com/adduc "adduc (1 commits)")[![peec](https://avatars.githubusercontent.com/u/131546?v=4)](https://github.com/peec "peec (1 commits)")

### Embed Badge

![Health badge](/badges/hydrawiki-ping/health.svg)

```
[![Health](https://phpackages.com/badges/hydrawiki-ping/health.svg)](https://phpackages.com/packages/hydrawiki-ping)
```

###  Alternatives

[kingdee-php/k3cloud

This is KingDee（金蝶） PHP SDK

106.2k1](/packages/kingdee-php-k3cloud)

PHPackages © 2026

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