PHP code example of php-dto / ip-address
1. Go to this page and download the library: Download php-dto/ip-address 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/ */
php-dto / ip-address example snippets
use \PhpDto\EmailAddress\EmailAddress;
use \PhpDto\EmailAddress\Exception\InvalidIpAddressException;
$ip = new IpAddress('192.168.1.1'); //spaces will be trimmed
echo $ip->get(); //will print '192.168.1.1'
echo (string) $ip; //will print '192.168.1.1'
echo json_encode([$ip]); //will print '["192.168.1.1"]'
new IpAddress('invalid.value'); //will throw InvalidIpAddressException (validate by FILTER_VALIDATE_IP)
shell script
composer