codificar/google-maps-provider

Google Maps 地理编码器适配器

4.4.0 2019-04-26 20:17 UTC

This package is auto-updated.

Last update: 2024-09-12 09:49:21 UTC


README

Build Status Latest Stable Version Total Downloads Monthly Downloads Code Coverage Quality Score Software License

这是 PHP Geocoder 的 Google Maps 提供者。这是一个 只读 仓库。有关信息和文档,请参阅 主仓库

用法

$httpClient = new \Http\Adapter\Guzzle6\Client();

// You must provide an API key
$provider = new \Geocoder\Provider\GoogleMaps\GoogleMaps($httpClient, null, 'your-api-key');

$result = $geocoder->geocodeQuery(GeocodeQuery::create('Buckingham Palace, London'));

所有请求都需要一个有效的 API 密钥,但是谷歌提供有 免费层。请参阅 此页面 获取 API 密钥的信息。

Google Maps for Business

以前,谷歌提供过其 API 的 "Business" 版本。该服务已被弃用,但是现有客户可以使用提供者上的静态 business 方法来创建客户端

$httpClient = new \Http\Adapter\Guzzle6\Client();

// Client ID is required. Private key is optional.
$provider = \Geocoder\Provider\GoogleMaps\GoogleMaps::business($httpClient, 'your-client-id', 'your-private-key');

$result = $geocoder->geocodeQuery(GeocodeQuery::create('Buckingham Palace, London'));

安装

composer require geocoder-php/google-maps-provider

贡献

欢迎贡献!请向 主仓库 发送拉取请求,或者在 问题跟踪器 上报告您找到的问题。