zmog / ipstacker
Ip Stack Api Call Wrapper
Installs: 1 291
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 0
Requires
- php: ^7.0
- ext-curl: *
This package is auto-updated.
Last update: 2024-11-20 00:01:16 UTC
README
Ip Stack Api Call Wrapper
Usage Exemples :
Basic Usage :
$Response = (new \Zmog\Libs\IpStacker\Request('<your_access_key>', '<ip_address>'))->Response(); $country_code = $Response->country_code(); /* Throw an exception if country_code is not present in response */ $country_code = $Response->country_code('US'); /* Use 'US' as default value if country_code is not present in response (no exception are thrown */
Advanced Usage :
$ip_a = [ '8.8.8.8', '1.1.1.1', ]; $Request = new \Zmog\Libs\IpStacker\Request('<your_access_key>', ...$ip_a); $Request->onlyLocation(); $Request->addCurrency(); /* Or chained method $Request = (new \Zmog\Libs\IpStacker\Request('<your_access_key>', ...$ip_a))->onlyLocation()->addCurrency(); */ /* Result of first ip : */ $is_eu_8dot = $Request->Response('8.8.8.8')->location()->is_eu(false); /* or $is_eu_8dot = $Request->Response()->location()->is_eu(false); */ /* Result of second ip */ $is_eu_1dot = $Request->Response('1.1.1.1')->location()->is_eu(false);