teamzac/geocoder
Composer 安装命令:
composer create-project teamzac/geocoder
包简介
A simple wrapper about Google's geocoding and direction services
README 文档
README
Installation
You can install the package via composer:
composer require teamzac/geocoder
Usage
This package uses Laravel's autodiscovery feature, so you do not have to manually add the service provider.
You can publish the config file if you'd like, or simply add the following to your .env file:
GOOGLE_MAPS_API_KEY={{YOUR API KEY HERE}}
The TeamZac\Geocoder\Geocoder class can be resolved from the container, or you can use the facade. There are two primary methods on this class:
// get lat/lng from an address Geocoder::geocode('1600 Pennsvylvania Ave, Washington DC 20500'); // get an address from lat/lng pair Geocoder::reverseGeocode(38.8976633, -77.036573);
Both methods will return an instance of TeamZac\Geocoder\GeocodeResult, or throw an exception if no results were found.
The GeocodeResult class is a simple data transfer object that makes it more convenience to access information about the response.
$result = Geocoder::geocode('123 main street anywhere USA'); $result->getState(); $result->getLocality(); $result->getStreetNumber();
For a full list of available methods, just check out the class' implementation.
Testing
composer test
You'll want to copy the .env.example file as .env.testing.php and add your Google Maps API key to enable testing.
Changelog
Please see CHANGELOG for more information what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security
If you discover any security related issues, please email chad@zactax.com instead of using the issue tracker.
Credits
teamzac/geocoder 适用场景与选型建议
teamzac/geocoder 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 103 次下载、GitHub Stars 达 0, 最近一次更新时间为 2016 年 08 月 30 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 teamzac/geocoder 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 teamzac/geocoder 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 103
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 3
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2016-08-30