PHP library to work with ReallyFreeFeoip
This package provides an API for the ReallyFreeFeoip
You can install the package via composer:
composer require faridbabayev/geoip
use FaridBabayev\Geoip\Geoip;
$geoip = new Geoip(); // this will fetch ip geolocation for server ip address
$geoip = new Geoip('75.197.224.3'); // this will ip geolocation for 75.197.224.3
You can get ip geolocation by accessing
$geoip = new Geoip();
$geoip->ip; //return ip address
$geoip->country_code; // return country code
$geoip->country_name; // return country name
$geoip->region_code; // return region code
$geoip->city; // return city
$geoip->zip_code; // return zip_code
$geoip->time_zone; // return time zone
$geoip->latitude; // return latitude
$geoip->metro_code; // return metro_code
You can change ip address for a new ip geolocation by calling for()
method without instantiating new class:
$geoip = new Geoip();
$geoip->for('75.197.224.3');
$geoip->country_code; // return country code
composer test
Please see CHANGELOG for more information what has changed recently.
Please see CONTRIBUTING for details.
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
The MIT License (MIT). Please see License File for more information.
This package was generated using the Laravel Package Boilerplate.