1. Go to this page and download the library: Download vectorface/whip 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/ */
vectorface / whip example snippets
use Vectorface\Whip\Whip;
$whip = new Whip();
$clientAddress = $whip->getValidIpAddress();
$whip = new Whip();
if (false === ($clientAddress = $whip->getValidIpAddress())) {
// handle the error
}
$whip = new Whip(Whip::CLOUDFLARE_HEADERS | Whip::REMOTE_ADDR);
$clientAddress = $whip->getValidIpAddress();
$range = new Vectorface\Whip\IpRange\Ipv4Range('10.0.*');
if ($range->containsIp($ipv4Address)) {
// handle the IP address being within the range
}
$range = new Vectorface\Whip\IpRange\Ipv6Range('::1/32');
if ($range->containsIp($ipv6Address)) {
// handle the IP address being within the range
}
// Get a Psr\Http\Message\ServerRequestInterface implementation from somewhere.
$request = ServerRequestFactory::fromGlobals();
// You can pass the request in the constructor.
$whip = new Whip(Whip::REMOTE_ADDR, [], $request);
// ... or set the request as the source of data.
$whip->setSource($request);
// ... or pass it to any function accepting a source argument.
$ip = $whip->getValidIpAddress($request);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.