Skip to content

Faridbabayev001/geoip

Repository files navigation

PHP library to work with ReallyFreeFeoip

Latest Version on Packagist Build Status Quality Score Total Downloads

This package provides an API for the ReallyFreeFeoip

Installation

You can install the package via composer:

composer require faridbabayev/geoip

Usage

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

Testing

composer test

Changelog

Please see CHANGELOG for more information what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email [email protected] instead of using the issue tracker.

Credits

License

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

Laravel Package Boilerplate

This package was generated using the Laravel Package Boilerplate.

About

PHP library to work with ReallyFreeFeoip

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages