Skip to content

gemzio/geoip

Repository files navigation

Get GeoIp informations from ip-api.com

Latest Version on Packagist GitHub Tests Action Status Quality Score Total Downloads

This package uses ip-api.com for getting geo ip informations.

Installation

You can install the package via composer:

composer require gemz/geoip

Usage

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",
]

Testing

composer test
composer test-coverage

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email stefan@sriehl.com instead of using the issue tracker.

Credits

Support us

Gemz.io is maintained by Stefan Riehl. You'll find all open source projects on Gemz.io github.

License

The MIT License (MIT). Please see License File for more information.

About

Get GeoIp from external service ip-api.com

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages