geocoder-php/here-provider

Geocoder here适配器

0.7.1 2023-07-09 14:05 UTC

This package is auto-updated.

Last update: 2024-09-04 10:48:53 UTC


README

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

这是来自PHP Geocoder的Here提供程序。这是一个只读仓库。有关信息和文档,请参阅主仓库

您可以在此处找到提供程序的文档

安装

composer require geocoder-php/here-provider

使用

Here平台上的新应用程序使用api_key身份验证方法。

$httpClient = new \Http\Discovery\Psr18Client();

// You must provide an API key
$provider = \Geocoder\Provider\Here\Here::createUsingApiKey($httpClient, 'your-api-key');

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

如果您正在使用传统的app_code身份验证方法,请像下面这样在提供程序上使用构造函数

$httpClient = new \Http\Discovery\Psr18Client();

// You must provide both the app_id and app_code
$provider = new \Geocoder\Provider\Here\Here($httpClient, 'app-id', 'app-code');

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

语言参数

定义结果中地址元素的首选语言。如果没有首选语言,Here地理编码器将返回以官方国家语言或地区主要语言显示的结果,以便当地人理解。语言代码必须按照RFC 4647标准提供。

贡献

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