sapioweb / geocode
使用 Google API 为 Laravel 5 & 5.1 提供的 PHP 地理编码
2.0.5
2016-04-25 18:47 UTC
Requires
- php: >=5.5.0
Requires (Dev)
- mockery/mockery: 0.9.*
- phpunit/phpunit: 4.7.*
This package is not auto-updated.
Last update: 2024-09-14 18:52:54 UTC
README
使用 Google API 为 Laravel 实现的 PHP 地址地理编码
安装
composer require sapioweb/geocode
在您的 config/app.php 文件中包含 Sapioweb\Geocode\GeocodeServiceProvider::class,
用法
use Sapioweb\Geocode\GeoCode; Route::get('/', function () { $geocode = new Geocode; $address = '1600 Wigwam Pkwy, Henderson, NV 89074'; $geocode = $geocode->getCoordinates($address); return view('welcome')->with(['geocode' => $geocode]); });
获取纬度: $geocode['geometry']['location']['lat'] 获取经度: $geocode['geometry']['location']['lng']
许可证
此软件是开源软件,许可协议为 MIT 许可证。如有疑问,请发送电子邮件至 andreas@sapioweb.com 或 info@sapioweb.com,或访问 Sapioweb.com 了解更多信息并取得联系。