All Projects → geerlingguy → Ping

geerlingguy / Ping

Licence: mit
A PHP class to ping hosts.

Projects that are alternatives of or similar to Ping

Androidnetworktools
Set of useful android network tools
Stars: ✭ 978 (+178.63%)
Mutual labels:  networking, ping
Powershell ipv4networkscanner
Powerful asynchronus IPv4 network scanner for PowerShell
Stars: ✭ 161 (-54.13%)
Mutual labels:  ping, mac
Fire
🔥A delightful HTTP/HTTPS networking framework for iOS/macOS/watchOS/tvOS platforms written in Swift.
Stars: ✭ 243 (-30.77%)
Mutual labels:  networking, mac
Netaddr
A network address manipulation library for Python
Stars: ✭ 648 (+84.62%)
Mutual labels:  networking, mac
Ship
A simple, handy network addressing multitool with plenty of features
Stars: ✭ 81 (-76.92%)
Mutual labels:  networking, mac
Go Ping
A simple ping library using ICMP echo requests.
Stars: ✭ 158 (-54.99%)
Mutual labels:  networking, ping
PsNetTools
PsNetTools is a cross platform PowerShell module to test network features on Windows, Linux and Mac.
Stars: ✭ 13 (-96.3%)
Mutual labels:  ping, class
Mpv Easy Player
MPV-EASY Player - A movie player based on mpv
Stars: ✭ 324 (-7.69%)
Mutual labels:  mac
Nsot
Network Source of Truth is an open source IPAM and network inventory database
Stars: ✭ 337 (-3.99%)
Mutual labels:  networking
Hackertarget
🎯 HackerTarget ToolKit - Tools And Network Intelligence To Help Organizations With Attack Surface Discovery 🎯
Stars: ✭ 320 (-8.83%)
Mutual labels:  ping
Dotnetty
DotNetty project – a port of netty, event-driven asynchronous network application framework
Stars: ✭ 3,422 (+874.93%)
Mutual labels:  networking
Cni
Container Network Interface - networking for Linux containers
Stars: ✭ 3,907 (+1013.11%)
Mutual labels:  networking
Exscript
A Python module making Telnet and SSH easy
Stars: ✭ 337 (-3.99%)
Mutual labels:  networking
Wg Meshconf
WireGuard full mesh configuration generator.
Stars: ✭ 319 (-9.12%)
Mutual labels:  networking
Autoedit 2
Fast text based video editing, node Electron Os X desktop app, with Backbone front end.
Stars: ✭ 343 (-2.28%)
Mutual labels:  mac
Glorious Demo
The easiest way to demonstrate your code in action.
Stars: ✭ 3,290 (+837.32%)
Mutual labels:  mac
Vault
swiss army knife for hackers
Stars: ✭ 346 (-1.42%)
Mutual labels:  networking
Handy
🔥简洁易用的C++11网络库 / 支持单机千万并发连接 / a simple C++11 network server framework
Stars: ✭ 3,815 (+986.89%)
Mutual labels:  networking
Colyseus
⚔ Multiplayer Framework for Node.js
Stars: ✭ 3,817 (+987.46%)
Mutual labels:  networking
Siphash
High-speed secure pseudorandom function for short messages
Stars: ✭ 331 (-5.7%)
Mutual labels:  mac
Ping for PHP Logo

Ping

Build Status

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 its benefits and drawbacks, and may work better or worse on a particular system.

Installation

$ composer require geerlingguy/ping

Usage

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

$host = 'www.example.com';
$ping = new \JJG\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 \JJG\Ping($host, $ttl, $timeout);

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

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

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

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

License

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

Author

Ping is maintained by Jeff Geerling, and is used to check servers for Server Check.in, an inexpensive website and server uptime monitoring service.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].