• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

jstayton/GoogleMapsGeocoder: A PHP wrapper for the Google Maps Geocoding API v3.

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称(OpenSource Name):

jstayton/GoogleMapsGeocoder

开源软件地址(OpenSource Url):

https://github.com/jstayton/GoogleMapsGeocoder

开源编程语言(OpenSource Language):

PHP 100.0%

开源软件介绍(OpenSource Introduction):

NOTICE: This project is deprecated and no longer maintained. If you'd like to continue supporting a forked version, please reach out on Twitter (@kidjustino) to have it listed here.

GoogleMapsGeocoder

Latest Stable Version Total Downloads

A PHP wrapper for the Google Maps Geocoding API v3.

Developed by Justin Stayton while at Monk Development.

Requirements

  • PHP >= 5.2.0

Installation

Composer

The recommended installation method is through Composer, a dependency manager for PHP. Just add jstayton/google-maps-geocoder to your project's composer.json file:

{
    "require": {
        "jstayton/google-maps-geocoder": "*"
    }
}

More details can be found over at Packagist.

Manually

  1. Copy src/GoogleMapsGeocoder.php to your codebase, perhaps to the vendor directory.
  2. Add the GoogleMapsGeocoder class to your autoloader or require the file directly.

Getting Started

We'll use the address of Monk Development for this example:

$address = "2707 Congress St., San Diego, CA 92110";

There are two ways to set the address of a GoogleMapsGeocoder object. Either the address can be passed to the constructor:

$Geocoder = new GoogleMapsGeocoder($address);

Or the address can be set after the object is created:

$Geocoder = new GoogleMapsGeocoder();
$Geocoder->setAddress($address);

By default, the format is set to json and the sensor is set to false. These values can be changed either through the constructor or after the object is created. See the documentation for the complete list of API parameters that can be changed.

Once all parameters are set, the final step is to send the request to the Google Maps Geocoding API:

$response = $Geocoder->geocode();

The geocode method converts the response into a JSON associative array (default) or SimpleXMLElement object depending on the specified format. See the geocode documentation for making the request over HTTPS or preventing conversion (instead returning the raw plain text response).

Feedback

Please open an issue to request a feature or submit a bug report. Or even if you just want to provide some feedback, I'd love to hear. I'm also available on Twitter as @kidjustino.

Contributing

  1. Fork it.
  2. Create your feature branch (git checkout -b my-new-feature).
  3. Commit your changes (git commit -am 'Added some feature').
  4. Push to the branch (git push origin my-new-feature).
  5. Create a new Pull Request.



鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap