1. Go to this page and download the library: Download librenms/ip-util library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
librenms / ip-util example snippets
try {
$ip = new IP('192.168.1.1');
// or
$ip = IP::parse('192.168.1.1');
} catch (InvalidIpException $e) {
//
}
echo $ip; // print nicely formated IP with cidr/prefix
echo $ip->address; // print just the address
echo $ip->cidr; // print the prefix length
echo $ip->compressed(); // Compresses IP addresses for easy reading
echo $ip->uncompressed(); // Uncompresses IP addresses for easy parsing
if ($ip->inNetwork('192.168.1.1/24')) {
echo $ip->getNetwork();
}
$ip = IP::fromHexString('c0a801fe');
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.