PHPackages                             ne0bot/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. ne0bot/ping

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

ne0bot/ping
===========

A PHP class to ping hosts.

1.1.2(9y ago)014MITPHP

Since Feb 2Pushed 8y ago1 watchersCompare

[ Source](https://github.com/ne0bot/Ping)[ Packagist](https://packagist.org/packages/ne0bot/ping)[ RSS](/packages/ne0bot-ping/feed)WikiDiscussions 1.x Synced 2w ago

READMEChangelogDependenciesVersions (2)Used By (0)

[![Ping for PHP Logo](https://raw.githubusercontent.com/geerlingguy/Ping/1.x/Resources/Ping-Logo.png)](https://raw.githubusercontent.com/geerlingguy/Ping/1.x/Resources/Ping-Logo.png)

Ping
====

[](#ping)

[![Total Downloads](https://camo.githubusercontent.com/5b95cc87a09179bc927b4cb366f70bdb0d0e2f3a11af8c38761329eeba3b20e4/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6e6530626f742f70696e672e737667)](https://packagist.org/packages/ne0bot/ping)[![Build Status](https://camo.githubusercontent.com/9467adbffbc756331c06e2455768c63a5628995ebb93d4ce43e056d921a9d442/68747470733a2f2f7472617669732d63692e6f72672f6e6530626f742f50696e672e7376673f6272616e63683d312e78)](https://travis-ci.org/ne0bot/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 !== -1) {
  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)

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

###  Health Score

28

—

LowBetter than 52% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 62.7% 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 ~362 days

Total

2

Last Release

3072d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/2814336?v=4)[Ne0 is not a Bot](/maintainers/ne0bot)[@ne0bot](https://github.com/ne0bot)

---

Top Contributors

[![geerlingguy](https://avatars.githubusercontent.com/u/481677?v=4)](https://github.com/geerlingguy "geerlingguy (42 commits)")[![ne0bot](https://avatars.githubusercontent.com/u/2814336?v=4)](https://github.com/ne0bot "ne0bot (14 commits)")[![strongwazz](https://avatars.githubusercontent.com/u/911315?v=4)](https://github.com/strongwazz "strongwazz (3 commits)")[![divinity76](https://avatars.githubusercontent.com/u/1874996?v=4)](https://github.com/divinity76 "divinity76 (3 commits)")[![sergiowww](https://avatars.githubusercontent.com/u/8181382?v=4)](https://github.com/sergiowww "sergiowww (2 commits)")[![marcbp](https://avatars.githubusercontent.com/u/5139232?v=4)](https://github.com/marcbp "marcbp (1 commits)")[![peec](https://avatars.githubusercontent.com/u/131546?v=4)](https://github.com/peec "peec (1 commits)")[![adduc](https://avatars.githubusercontent.com/u/44527?v=4)](https://github.com/adduc "adduc (1 commits)")

### Embed Badge

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

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

###  Alternatives

[pboivin/filament-peek

Full-screen page preview modal for Filament

252365.8k17](/packages/pboivin-filament-peek)[medienbaecker/kirby-alter

241.6k](/packages/medienbaecker-kirby-alter)

PHPackages © 2026

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