Geolocator provides an easy-to-use, versatile, object-oriented interface to the IP Location API provided by ipinfodb.com. This API allows you to find the city, state/region, country, and approximate latitude/longitude associated with an IP address or domain.
It requires PHP 5.3.0 or greater, with cURL and JSON support. (It may work with less than v5.3.0, but this is not supported.)
- Versatile interface for location lookups of one or many domains/IPs
- Allows some array and iterator behavior for simplicity when working with large datasets (not yet totally implemented)
- Most methods are chainable, meaning you can do things like
$location = Geolocator::instantiate($apiKey, $myIp)->setPrecision(Geolocator::PRECISION_COUNTRY)->getLocation();
on one line - User can control when blocking (network) operations occur.
General guide to using the class:
- Create the Geolocator object. Set the API key in the constructor.
- Add one or multiple IPs/domains.
- Access the results.
For complete documentation, see the documentationn (in JavaDoc format) in the Geolocator class.
For examples of using this class and all its features, see the examples directory in this distribution.
The current and development versions are maintained on Github.
There is not currently a stable working version. v3 (beta) is currently in development and is stable enough for development.
The project is dual-licensed under the MIT license and the GPLv3.
This software was written by Chris Dzombak.