sudiptpa / geoip
A simple IP to Geo Location implementation library.
Installs: 4 635
Dependents: 0
Suggesters: 0
Security: 0
Stars: 3
Watchers: 1
Forks: 0
Open Issues: 0
Requires
- php: ~7.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ~2.0
- mockery/mockery: ^0.9.4
- phpunit/phpunit: ~6.0
This package is auto-updated.
Last update: 2022-02-01 13:11:32 UTC
README
This package is abandoned and no longer maintained. The author suggests using the https://github.com/sudiptpa/ipstack package instead.
[The old freegeoip API is now deprecated and will be discontinued on July 1st, 2018]
A simple implementation for IP to Location with http://freegeoip.net an open source platform.
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.
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.
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.
Installation
You can install the package via composer: Composer.
composer require sudiptpa/geoip
And run composer to update your dependencies:
$ curl -s http://getcomposer.org/installer | php
$ php composer.phar update
Usage
This package only supports json
format for now.
Here are a few examples on how you can use the package:
$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.
Changelog
Please see CHANGELOG for more information what has changed recently.
Contributing
Contributions are welcome and will be fully credited.
Contributions can be made via a Pull Request on Github.
Testing
composer test
Support
If you are having general issues with the package, feel free to drop me and email sudiptpa@gmail.com
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.