This package is abandoned and no longer maintained. The author suggests using the https://github.com/sudiptpa/ipstack package instead., (*1)
[The old freegeoip API is now deprecated and will be discontinued on July 1st, 2018], (*2)
, (*3)
http://freegeoip.net provides a public HTTP API for software developers to search the geolocation of IP addresses. It uses a database of IP addresses that are associated to cities along with other relevant information like time zone, latitude and longitude., (*4)
You're allowed up to 15,000 queries per hour by default. Once this limit is reached, all of your requests will result in HTTP 403, forbidden, until your quota is cleared., (*5)
The freegeoip web server is free and open source so if the public service limit is a problem for you, download it and run your own instance., (*6)
Installation
You can install the package via composer: Composer., (*7)
composer require sudiptpa/geoip
And run composer to update your dependencies:, (*8)
$ curl -s http://getcomposer.org/installer | php
$ php composer.phar update
Usage
This package only supports json
format for now., (*9)
Here are a few examples on how you can use the package:, (*10)
$geo = new Sujip\GeoIp\GeoIp($ip);
$geo->country();
$geo->city();
$geo->region();
Also have a look in the source code of Sujip\GeoIp\GeoIp
to discover the methods you can use., (*11)
Changelog
Please see CHANGELOG for more information what has changed recently., (*12)
Contributing
Contributions are welcome and will be fully credited., (*13)
Contributions can be made via a Pull Request on Github., (*14)
Testing
composer test
, (*15)
Support
If you are having general issues with the package, feel free to drop me and email sudiptpa@gmail.com, (*16)
If you believe you have found a bug, please report it using the GitHub issue tracker,
or better yet, fork the library and submit a pull request., (*17)