marcoboom / google-maps-geocode-api
Google Maps Geocode API 的简单 PHP 封装
2.0.1
2015-07-24 13:46 UTC
Requires
- php: >=5.5.0
This package is not auto-updated.
Last update: 2024-09-14 17:00:50 UTC
README
Google Maps Geocode API 的简单 PHP 封装
安装和需求
首先,你需要使用 Composer 请求此包
$ composer require marcoboom/google-maps-geocode-api
此包需要 PHP 5.4 和 Guzzle
用法
$geo = new GoogleMapsGeocodeApi\Geocode("Kalverstraat 100 Amsterdam"); echo "Street: ".$geo->street().PHP_EOL; echo "Housenumber: ".$geo->housenumber().PHP_EOL; echo "Postcode: ".$geo->postcode().PHP_EOL; echo "City: ".$geo->city().PHP_EOL; echo "Town: ".$geo->town().PHP_EOL; echo "Province: ".$geo->state().PHP_EOL; echo "Country: ".$geo->country().PHP_EOL; echo "Country code: ".$geo->country_code().PHP_EOL; echo "Latitude: ".$geo->lat().PHP_EOL; echo "Longitude: ".$geo->lon().PHP_EOL; echo "Formatted address: ".$geo->formatted().PHP_EOL;