Download the PHP package purplepixie/php-ping without Composer
On this page you can find all versions of the php package purplepixie/php-ping. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download purplepixie/php-ping
More information about purplepixie/php-ping
Files in purplepixie/php-ping
Package php-ping
Short Description PHP ICMP/Ping Network Client
License GPL-3.0-only
Informations about the package php-ping
php-ping
PPPing, the Purplepixie PHP Ping Library is a low-level socket based ICMP ping library written by David Cutting for use within the FreeNATS Network Monitor but now spun out as a standalone library.
Obtaining PPPing
The easiest option is to use composer to be able to obtain the latest package via Packagist with the command:
Using composer you can then autoload the classes as needed.
You can also download the source directly (from a tagged release or clone the repo) and include the file .
Note the class is in the namespace .
Using PPPing
Once included it's very simple to use PPPing.
Additional Information Available
Following a ping information about the last result is available via which is an associative array with keys as follows:
- set - boolean indicating if data was returned or not
- result - the result value of the ping (negative number means error, 0 or positive is return time in ms)
- ttl - the TTL of the returned packet
- hops - an estimation of the hops based on socket TTL and returned TTL (not always accurate)
- source - IP address of the return packet source (the remote system)
- destination - IP address of the destination of the return packet (local system)
Other Options and Variables
Various options can be read and set as needed within the object
- gets the remote hostname or IP
- sets the remote hostname or IP
- gets the TTL
- sets the TTL
- gets the Timeout (seconds)
- sets the Timeout (seconds)
- gets the packet package (defaults to "PPPing")
- sets the packet package
- gets the debug status flag (boolean)
- sets the debug status flag (boolean)
- gets the sequence
- sets the sequence
- gets the identity used
- gets the data about the last ping
Example CLI Implementation
In the folder is a ping.php which can be run on the command-line to demonstrate the functionality of PPPing. Options to the script are: