stadiamaps/api
最新稳定版本:v4.0.1
Composer 安装命令:
composer require stadiamaps/api
包简介
The Stadia Maps Geospatial APIs provide you with the data you need to build awesome applications.
README 文档
README
The Stadia Maps Geospatial APIs provide you with the data you need to build awesome applications.
For more information, please visit https://docs.stadiamaps.com.
Installation & Usage
Requirements
PHP 8.1 and later.
Composer
To install the bindings via Composer, add something like this to composer.json:
{
"require": {
"stadiamaps/stadiamaps-api-php": "4.*"
}
}
Then run composer install
Manual Installation
Download the files and include autoload.php:
<?php require_once('/path/to/OpenAPIClient-php/vendor/autoload.php');
Getting Started
First, you'll need a Stadia Maps API key. Then, you can use or require (depending on your installation method) the package. Here's a code sample.
<?php // Pick one: // // Composer: // use OpenAPI\Client\Configuration; // use OpenAPI\Client\Api\GeocodingApi; // use OpenAPI\Client\ApiException; // use GuzzleHttp; // // Manual installation: // require_once(__DIR__ . '/vendor/autoload.php'); // Configure API key authorization // NOTE: manual installation users will need the full path, like // OpenAPI\Client\Configuration $config = Configuration::getDefaultConfiguration()->setApiKey('api_key', 'YOUR_API_KEY'); $apiInstance = new GeocodingApi( new GuzzleHttp\Client(), $config ); $text = '1600 Pennsylvania Ave NW'; // The place name (address, venue name, etc.) to search for. try { $result = $apiInstance->searchV2($text, lang: 'en'); print_r($result); } catch (Exception $e) { echo 'Exception when calling GeocodingApi->searchV2: ', $e->getMessage(), PHP_EOL; }
For more examples, check out the integration tests.
统计信息
- 总下载量: 662
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: BSD-3-Clause
- 更新时间: 2024-07-09