Geo IP
![Software License][ico-license]
![Coverage Status][ico-scrutinizer]
![Total Downloads][ico-downloads], (*1)
Geo Ip took all available information from an Ip Address using data from GeoPlugin., (*2)
Work with Laravel 5.5 (tested)., (*3)
Geo IP use Geoplugin to gather information., (*4)
Install
You can install GeoIp via composer., (*5)
``` bash
$ composer require sabartampubolon/geoip, (*6)
Requires Laravel Framework 5.5 and PHP 5.5.9 or newer. Visit GeoIp repository at [Packagist](https://packagist.org/packages/sabartampubolon/geoip).
## Usage
To use GeoIp, you can simply inject GeoIp instance into Laravel controller
``` php
<?php
use Sabartampubolon\Geoip\Geoip;
// Use destination Ip
$geoip = new Geoip('8.8.8.8');
// Or just let it blank to automatic use client ip address
$geoip = new Geoip();
// Gather information from ip address
$info = $geoip->getInfo();
The code above will give a result in json format like this (use IP Address 8.8.8.8):, (*7)
json
{"ip_address":"8.8.8.8","country_code":"US","country_name":"United States","city":"Mountain View","region":"CA","region_name":"California","region_code":"CA","latitude":"37.3845","longitude":"-122.0881"}
, (*8)
Credits
License
The MIT License (MIT). Please see License File for more information., (*9)