A Laravel package to get the client's country using the ip. A wrapper for http://ip2nation.com
dimsav/laravel-ip-service is a Laravel package for a laravel package to get the client's country using the ip. a wrapper for http://ip2nation.com.
It currently has 118 GitHub stars and 50 downloads on Packagist (latest version v1).
Install it with composer require dimsav/laravel-ip-service.
Discover more Laravel packages by dimsav
or browse all Laravel packages to compare alternatives.
Last updated
Tries to guess the country code of the client, using his IP.
Download and import the ip database from ip2nation.com
$service = App::make('Dimsav\IpService\IpService');
// country code for the given ip address
echo $service->getCountryCodeFromIp('123.123.123.123');
// country code for the client's ip address
echo $service->getCountryCodeFromClientIp();