This package uses ip-api.com for getting geo ip informations.
You can install the package via composer:
composer require gemz/geoip
use \Gemz\GeoIp\GeoIp;
// get by domain
$result = GeoIp::for('gemz.io')->get();
// get by ip
$result = GeoIp::for('52.59.200.190')->get();
// result in specific locale
// supported are de, en, fr, es default is en
$result = GeoIp::for('gemz.io')->locale('en')->get();
// response is an array with these values
array:17 [
"status" => "success"
"country" => "Germany"
"countryCode" => "DE"
"region" => "HE"
"regionName" => "Hesse"
"city" => "Frankfurt am Main"
"zip" => "60313"
"lat" => 50.1109
"lon" => 8.68213
"timezone" => "Europe/Berlin"
"isp" => "Amazon Technologies Inc."
"org" => "AWS EC2 (eu-central-1)"
"as" => "AS16509 Amazon.com, Inc."
"asname" => "AMAZON-02"
"reverse" => "ec2-52-59-200-190.eu-central-1.compute.amazonaws.com"
"proxy" => false
"query" => "52.59.200.190"
]
// if request is not successful
[
"status" => "fail",
"query" => "notvalid domain",
]
composer test
composer test-coverage
Please see CHANGELOG for more information on what has changed recently.
Please see CONTRIBUTING for details.
If you discover any security related issues, please email stefan@sriehl.com instead of using the issue tracker.
Gemz.io is maintained by Stefan Riehl. You'll find all open source projects on Gemz.io github.
The MIT License (MIT). Please see License File for more information.