wowworks/geocoder-php-dadata-provider
Composer 安装命令:
composer require wowworks/geocoder-php-dadata-provider
包简介
Integration with Dadata suggestions API.
关键字:
README 文档
README
Geocoder DaData adapter
Geocoder DaData adapter. Integration with Dadata suggestions API.
Installation
This extension is available at packagist.org and can be installed via composer by following command:
composer require wowworks/geocoder-php-dadata-provider
Configuration
To work, you need to connect the package wowworks/geocoder-php-dadata-provider
Example:
$service = new \DadataSuggestions\DadataSuggestionsService(); $service->setUrl('https://suggestions.dadata.ru/suggestions/api/4_1/rs/suggest/'); $service->setToken('...'); $dadataProvider = new \Wowworks\Dadata\Dadata($service); $collection = $dadataProvider->geocodeQuery(\Geocoder\Query\GeocodeQuery::create('г Москва, улица Академика Королева, дом 15, корп. 2')); foreach ($collection->all() as $location) { $location->getCoordinates()->getLatitude(); $location->getCoordinates()->getLongitude(); $location->getCountry(); foreach ($location->getAdminLevels() as $level) { if ($level instanceof AdminLevel) { $level->getName(); } } $location->getLocality(); $location->getSubLocality(); $location->getStreetName(); $location->getStreetNumber(); $location->getProvidedBy(); }
统计信息
- 总下载量: 21.01k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2019-11-18