Laravel Client for ip2country
You can install the package via composer:
composer require sicaboy/ip2country-laravel
You can publish the config file with:
php artisan vendor:publish --tag="ip2country-laravel-config"
This is the contents of the published config file:
return [
'api_key' => env('IP2COUNTRY_API_KEY'),
'api_url' => env('IP2COUNTRY_API_URL', 'https://ip2country.yourdomain.com'),
];
use Sicaboy\Ip2countryLaravel\Facades\Ip2country;
Ip2countryLaravel::getCountryCode('1.1.1.1');
Ip2countryLaravel::getCountryCode(request()->ip())
You will get the country code of the IP address.
composer test
Please see CHANGELOG for more information on what has changed recently.
Please see CONTRIBUTING for details.
Please review our security policy on how to report security vulnerabilities.
The MIT License (MIT). Please see License File for more information.