tiran133 / ipinfodb-php
PHP IP to Country for https://ipinfodb.com/api
Installs: 7 741
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 0
Requires
- guzzlehttp/guzzle: ^6.3
README
How to install:
Install Package
composer require tiran133/ipinfodb-php
Publish Config
php artisan vender:publish --provider="Tiran133\Laravel\IPInfoDBServiceProvider"
Add your api key to .env
IPINFODB_API_KEY=<Your IP Key>
How to use:
Via Facade:
Country:
$country = \Tiran133\Laravel\Facade\IPInfo::getCountry($ip); $country->countryName; $country->countryCode;
City:
$city = \Tiran133\Laravel\Facade\IPInfo::getCity($ip); $city->countryName; $city->countryCode; $city->regionName; $city->cityName; $city->zipCode; $city->latitude; $city->longitude; $city->timeZone;
Via app()
Country:
$ipinfo = app('ipinfodb'); $country = $ipinfo->getCountry($ip); $country->countryName; $country->countryCode;
City:
$city = \Tiran133\Laravel\Facade\IPInfo::getCity($ip); $city->countryName; $city->countryCode; $city->regionName; $city->cityName; $city->zipCode; $city->latitude; $city->longitude; $city->timeZone;