bmlt-enabled / geo-api-php-client
Cached geocoding and timezone lookups for BMLT-enabled applications. Every endpoint requires an API key (Settings → API Keys) sent as a Bearer token.
Package info
github.com/bmlt-enabled/geo-api-php-client
pkg:composer/bmlt-enabled/geo-api-php-client
Requires
- php: ^8.1
- ext-curl: *
- ext-json: *
- ext-mbstring: *
- guzzlehttp/guzzle: ^7.3 || ^8.0
- guzzlehttp/psr7: ^1.7 || ^2.0 || ^3.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.5
- phpunit/phpunit: ^8.0 || ^9.0
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
Cached geocoding and timezone lookups for BMLT-enabled applications. Every endpoint requires an API key (Settings → API Keys) sent as a Bearer token.
Installation & Usage
Requirements
PHP 8.1 and later.
Composer
To install the bindings via Composer, add the following to composer.json:
{
"repositories": [
{
"type": "vcs",
"url": "https://github.com/bmlt-enabled/geo-api-php-client.git"
}
],
"require": {
"bmlt-enabled/geo-api-php-client": "*@dev"
}
}
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
Please follow the installation procedure and then run the following:
<?php require_once(__DIR__ . '/vendor/autoload.php'); // Configure Bearer authorization: bearerAuth $config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN'); $apiInstance = new OpenAPI\Client\Api\GeocodingApi( // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. // This is optional, `GuzzleHttp\Client` will be used as default. new GuzzleHttp\Client(), $config ); $application = 'application_example'; // string | Your application identifier (used for analytics). $search = 'search_example'; // string | Address or place to geocode. $referrer = 'referrer_example'; // string | URL of the requesting page (region detection + analytics). $language = 'language_example'; // string | BCP-47 language code (default: en). $region = 'region_example'; // string | Region bias as a ccTLD (e.g. \"fr\", \"ca\"). Overrides the region inferred from the referrer domain — useful when the referrer has no country TLD. $north = 3.4; // float | Viewport north bound (decimal degrees). $south = 3.4; // float | Viewport south bound (decimal degrees). $east = 3.4; // float | Viewport east bound (decimal degrees). $west = 3.4; // float | Viewport west bound (decimal degrees). try { $result = $apiInstance->geocode($application, $search, $referrer, $language, $region, $north, $south, $east, $west); print_r($result); } catch (Exception $e) { echo 'Exception when calling GeocodingApi->geocode: ', $e->getMessage(), PHP_EOL; }
API Endpoints
All URIs are relative to https://geo.aws.bmlt.app
| Class | Method | HTTP request | Description |
|---|---|---|---|
| GeocodingApi | geocode | GET /api/geocode | Geocode an address or place |
| TimezoneApi | timezone | GET /api/timezone | Look up the timezone for a location |
Models
- Geocode200Response
- Geocode200ResponseRequest
- Geocode200ResponseResultsInner
- Geocode200ResponseResultsInnerAddressComponentsInner
- Geocode200ResponseResultsInnerGeometry
- Geocode200ResponseResultsInnerGeometryBounds
- Geocode200ResponseResultsInnerGeometryLocation
- Geocode200ResponseResultsInnerGeometryViewport
- Geocode200ResponseResultsInnerGeometryViewportNortheast
- Timezone200Response
Authorization
Authentication schemes defined for the API:
bearerAuth
- Type: Bearer authentication
Tests
To run the tests, use:
composer install vendor/bin/phpunit
Author
About this package
This PHP package is automatically generated by the OpenAPI Generator project:
- API version:
1.0.0- Package version:
1.0.4 - Generator version:
7.27.0-SNAPSHOT
- Package version:
- Build package:
org.openapitools.codegen.languages.PhpClientCodegen