iplookup / iplookup
Get location information based on client ip
0.3.8
2022-01-21 08:03 UTC
Requires
- php: >=5.6.0
- guzzlehttp/guzzle: ^6.3
- symfony/cache: ^3.4
Requires (Dev)
- phpunit/phpunit: ^5.7
README
Install
composer require iplookup/iplookup
Lib
Get location information via remote ip address
Sample
use IPLookup\Client\TaobaoClient;
use IPLookup\IPLookupService;
use Symfony\Component\Cache\Simple\FilesystemCache;
require dirname(__DIR__) . '/vendor/autoload.php';
$ip = '115.60.19.180';
$iplookupService = new IPLookupService(new TaobaoClient(new FilesystemCache('namespace', 1 * 60 * 60, dirname(__DIR__) . '/runtime/cache')));
echo $iplookupService->lookup($ip) . PHP_EOL;
$ip = \IPLookup\Util::getCurrentIP();
echo $iplookupService->lookup($ip) . PHP_EOL;
License
Copyright 2008-2018.
Licensed under the GNU Lesser General Public License, Version 3.0