PHPackages                             socloz/geocoder - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. socloz/geocoder

AbandonedArchivedLibrary[Utility &amp; Helpers](/categories/utility)

socloz/geocoder
===============

The almost missing Geocoder PHP 5.3 library.

1.1.3(13y ago)114.1kMITPHPPHP &gt;=5.3.0

Since Jan 2Pushed 13y ago10 watchersCompare

[ Source](https://github.com/SoCloz/Geocoder)[ Packagist](https://packagist.org/packages/socloz/geocoder)[ Docs](http://geocoder-php.org)[ RSS](/packages/socloz-geocoder/feed)WikiDiscussions socloz-master Synced 1mo ago

READMEChangelogDependencies (3)Versions (21)Used By (0)

Geocoder
========

[](#geocoder)

**Geocoder** is a library which helps you build geo-aware applications. It provides an abstraction layer for geocoding manipulations. The library is splitted in two parts: `HttpAdapter` and `Provider` and is really extensible.

[![Build Status](https://camo.githubusercontent.com/49bb34db80202efd081de884ceb7fa97c85c067246799bf131b37a1b88c0dbe7/68747470733a2f2f7365637572652e7472617669732d63692e6f72672f77696c6c647572616e642f47656f636f6465722e706e673f6272616e63683d6d6173746572)](http://travis-ci.org/willdurand/Geocoder)

### HttpAdapters

[](#httpadapters)

*HttpAdapters* are responsible to get data from remote APIs.

Currently, there are the following adapters:

- `BuzzHttpAdapter` to use [Buzz](https://github.com/kriswallsmith/Buzz), a lightweight PHP 5.3 library for issuing HTTP requests;
- `CurlHttpAdapter` to use [cURL](http://php.net/manual/book.curl.php);
- `GuzzleHttpAdapter` to use [Guzzle](https://github.com/guzzle/guzzle), PHP 5.3+ HTTP client and framework for building RESTful web service clients;
- `SocketHttpAdapter` to use a [socket](http://www.php.net/manual/function.fsockopen.php);
- `ZendHttpAdapter` to use [Zend Http Client](http://framework.zend.com/manual/2.0/en/modules/zend.http.client.html).

### Providers

[](#providers)

*Providers* contain the logic to extract useful information.

Currently, there are many providers for the following APIs:

- [FreeGeoIp](http://freegeoip.net/static/index.html) as IP-Based geocoding provider;
- [HostIp](http://www.hostip.info/) as IP-Based geocoding provider;
- [IpInfoDB](http://www.ipinfodb.com/) as IP-Based geocoding provider;
- [Yahoo! PlaceFinder](http://developer.yahoo.com/geo/placefinder/) as Address-Based geocoding and reverse geocoding provider;
- [Google Maps](http://code.google.com/apis/maps/documentation/geocoding/) as Address-Based geocoding and reverse geocoding provider;
- [Google Maps for Business](https://developers.google.com/maps/documentation/business/webservices) as Address-Based geocoding and reverse geocoding provider;
- [Bing Maps](http://msdn.microsoft.com/en-us/library/ff701715.aspx) as Address-Based geocoding and reverse geocoding provider;
- [OpenStreetMaps](http://nominatim.openstreetmap.org/) as Address-Based geocoding and reverse geocoding provider;
- [CloudMade](http://developers.cloudmade.com/projects/show/geocoding-http-api) as Address-Based geocoding and reverse geocoding provider;
- [Geoip](http://php.net/manual/book.geoip.php), the PHP extension, as IP-Based geocoding provider;
- ChainProvider is a special provider that takes a list of providers and iterates over this list to get information;
- [MapQuest](http://open.mapquestapi.com/) as Address-Based geocoding and reverse geocoding provider;
- [OIORest](http://geo.oiorest.dk/) as very accurate Address-Based geocoding and reverse geocoding provider (exclusively in Denmark);
- [GeoCoder.ca](http://geocoder.ca/) as Address-Based geocoding and reverse geocoding provider (exclusively in USA &amp; Canada);
- [GeoCoder.us](http://geocoder.us/) as Address-Based geocoding provider (exclusively in USA);
- [IGN OpenLS](http://www.ign.fr/) as Address-Based geocoding provider (exclusively in France);
- [DataScienceToolkit](http://www.datasciencetoolkit.org/) as IP-Based geocoding provider;
- [Yandex](http://api.yandex.com.tr/maps/doc/geocoder/desc/concepts/About.xml) as Address-Based geocoding and reverse geocoding provider;
- [GeoPlugin](http://www.geoplugin.com/webservices) as IP-Based geocoding provider;
- [GeoIPs](http://www.geoips.com/developer/geoips-api) as IP-Based geocoding provider;
- [MaxMind web service](http://dev.maxmind.com/geoip/web-services) as IP-Based geocoding provider.

Installation
------------

[](#installation)

The recommended way to install Geocoder is through composer.

Just create a `composer.json` file for your project:

```
{
    "require": {
        "willdurand/geocoder": "*"
    }
}
```

And run these two commands to install it:

```
$ wget http://getcomposer.org/composer.phar
$ php composer.phar install
```

Now you can add the autoloader, and you will have access to the library:

```
