Created
April 24, 2015 11:30
-
-
Save olivierphi/55e1cf03d9da67767c55 to your computer and use it in GitHub Desktop.
PHP Geocoder test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
<<<CONFIG | |
packages: | |
- "willdurand/geocoder: ~3.0" | |
- "symfony/var-dumper: ~2.6" | |
CONFIG; | |
/** | |
* [PHP GeoCoder](https://github.com/geocoder-php/Geocoder) rulez! ♥ | |
*/ | |
// Run me with [Melody](http://melody.sensiolabs.org/) | |
// (install: sudo sh -c "curl http://get.sensiolabs.org/melody.phar -o /usr/local/bin/melody && chmod a+x /usr/local/bin/melody") | |
use Symfony\Component\VarDumper\VarDumper; | |
$curl = new \Ivory\HttpAdapter\CurlHttpAdapter(); | |
$geocoder = new \Geocoder\Provider\GoogleMaps($curl); | |
// French malformed address (should be "Jeuneurs" instead of "Jeunurs") resolution: | |
VarDumper::dump($geocoder->geocode('23 rue des Jeunurs')); | |
// Multiple results, with city hint: | |
VarDumper::dump($geocoder->geocode('3 abbeys road, London')); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment