jguittard/zf-geocoder
Composer 安装命令:
composer require jguittard/zf-geocoder
包简介
Geocoder Service module for Zend Framework
关键字:
README 文档
README
This package allows you to use Geocoder in Zend Framework.
It is still compatible with Zend Framework 2 and 3 Service Manager.
Requirements
Please see the composer.json file.
Installation
Run the following composer command:
$ composer require "jguittard/zf-geocoder:~1.0"
Alternately, manually add the following to your composer.json, in the require section:
"require": { "jguittard/zf-geocoder": "~1.0" }
And then run composer update to ensure the module is installed.
Finally, add the module name to your project's config/application.config.php under the modules
key:
return array( /* ... */ 'modules' => array( /* ... */ 'ZF\Geocoder', ), /* ... */ );
Or rely on Zend Component Installer to inject this module automatically
composer require zendframework/zend-composer-installer:^0.4
Configuration
Copy the config/zf.geocoder.local.php.dist to the config/autoload directory and remove the dist extension to jump start configuration.
Usage
You can retrieve Geocoder documentation
The following will handle setup and service management within this Zend Framework module.
First, make sure you have set up your configuration file by commenting out the provider(s) you'd like to use.
For example, in config/autoload/zf.geocoder.local.php:
return [ 'geocoder' => [ 'httpAdapter' => '<SERVICE_KEY_OF_HTTP_ADAPTER>', 'providers' => [ 'google_maps' => [ 'locale' => 'fr_FR', 'region' => 'Île-de-France', 'useSsl' => false, ], ], ], ];
Every provider is exposed as a service in the main Service Manager following the convention: Geocoder\<PROVIDER_NAME_IN_CAMELCASE>
Such service will be an instance of corresponding Geocoder\Provider\<PROVIDER_NAME_IN_CAMELCASE> with appropriate configuration passed to its constructor
For example, in your controller:
public function localeAction() { /* ... */ $geocoder = $this->getServiceLocator()->get('Geocoder\GoogleMaps'); $addressCollection = $geocoder->geocode('10 avenue Gambetta, Paris, France'); /* ... */ }
Obviously, such a call is bad practice. You should consider injecting your Geocoder service in a dedicated service, not call it from a controller
Unit tests
Make sure dev dependencies are installed
composer install --dev
Run the unit tests
composer test
Code styling check
composer cs-check
Check both
composer check
jguittard/zf-geocoder 适用场景与选型建议
jguittard/zf-geocoder 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 207 次下载、GitHub Stars 达 1, 最近一次更新时间为 2016 年 10 月 15 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「geocoding」 「geocoder」 「zf」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 jguittard/zf-geocoder 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 jguittard/zf-geocoder 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 jguittard/zf-geocoder 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Maps in minutes. Powered by the Google Maps API.
Yii2 map input widget. Allows you to select geographcal coordinates via a human-friendly inteface.
GISCO Geocoding Provider for Geocoder PHP.
Integration of Geocoder into Symfony2
Laravel integration for Nominatim Geocoding API Client
Geocoder LocationIQ adapter
统计信息
- 总下载量: 207
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 5
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: BSD-3-Clause
- 更新时间: 2016-10-15