lajosbencz / here-php
This document describes the Geocoding and Search API.
v0.2.2
2021-02-18 15:00 UTC
Requires
- php: >=7.2
- ext-curl: *
- ext-json: *
- ext-mbstring: *
- guzzlehttp/guzzle: ^6.2
Requires (Dev)
- friendsofphp/php-cs-fixer: ^2.12
- phpunit/phpunit: ^8.0 || ^9.0
README
This document describes the Geocoding and Search API.
Installation & Usage
Requirements
PHP 7.2 and later.
Composer
To install the bindings via Composer, add the following to composer.json
:
{ "repositories": [ { "type": "vcs", "url": "https://github.com/lajosbencz/here-php.git" } ], "require": { "lajosbencz/here-php": "*@dev" } }
Then run composer install
Manual Installation
Download the files and include autoload.php
:
<?php require_once('/path/to/here-php/vendor/autoload.php');
Getting Started
Please follow the installation procedure and then run the following:
<?php require_once(__DIR__ . '/vendor/autoload.php'); // Configure API key authorization: apiKey $config = Here\Configuration::getDefaultConfiguration()->setApiKey('apiKey', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Here\Configuration::getDefaultConfiguration()->setApiKeyPrefix('apiKey', 'Bearer'); // Configure Bearer (JWT) authorization: bearerAuth $config = Here\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN'); $apiInstance = new Here\Api\DefaultApi( // 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 ); $q = Berlin Pariser 20; // string | Enter a free-text query Examples: * `ber`, `berl`, `berli`, ... * `berlin+p`, `berlin+paris`, `berlin+parise`, ... * `berlin+pariser+20` _Note: Whitespace, urls, email addresses, or other out-of-scope queries will yield no results._ $at = 'at_example'; // string | Specify the center of the search context expressed as coordinates. Format: `{latitude},{longitude}` Type: `{decimal},{decimal}` Example: `-13.163068,-72.545128` (Machu Picchu Mountain, Peru) $in = 'in_example'; // string | Search within a geographic area. This is a hard filter. Results will be returned if they are located within the specified area. A geographic area can be * a country (or multiple countries), provided as comma-separated [ISO 3166-1 alpha-3](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-3) country codes The country codes are to be provided in all uppercase. Format: `countryCode:{countryCode}[,{countryCode}]*` Examples: * `countryCode:USA` * `countryCode:CAN,MEX,USA` $limit = 5; // int | Maximum number of results to be returned. $types = array('types_example'); // string[] | BETA: Limit the result items to the specified types. Currently supported values of the type filter for Autocomplete: | * `city` - restricting results to result type `locality` and locality type `city` | * `postalCode` - restricting results to result type `locality` and locality type `postalCode`, | * `area` - restricting results to result types: `locality` or `administrativeArea` including all the sub-types | |Provide one of the supported values or a comma separated list. | | $lang = 'lang_example'; // string | Select the preferred response language for result rendering from a list of BCP47 compliant Language Codes. The autocomplete endpoint tries to detect the query language based on matching name variants and then chooses the same language for the response. Therefore the end-user can see and recognize all the entered terms in the same language as in the query. The specified preferred language is used only for not matched address tokens and for matched address tokens in case of ambiguity $x_request_id = 'x_request_id_example'; // string | Used to correlate requests with their responses within a customer's application, for logging and error reporting. Format: Free string, but a valid UUIDv4 is recommended. try { $result = $apiInstance->autocompleteGet($q, $at, $in, $limit, $types, $lang, $x_request_id); print_r($result); } catch (Exception $e) { echo 'Exception when calling DefaultApi->autocompleteGet: ', $e->getMessage(), PHP_EOL; }
API Endpoints
All URIs are relative to http://localhost
Models
- AccessResponseCoordinate
- Address
- AutocompleteResultItem
- AutosuggestEntityResultItem
- AutosuggestQueryResultItem
- BrowseResultItem
- Category
- Chain
- Contact
- ContactInformation
- DisplayResponseCoordinate
- ErrorResponse
- FieldScore
- GeocodeResultItem
- LookupResponse
- MapView
- MatchInfo
- OneboxSearchResultItem
- OpenSearchAutocompleteResponse
- OpenSearchAutosuggestResponse
- OpenSearchBrowseResponse
- OpenSearchGeocodeResponse
- OpenSearchReverseGeocodeResponse
- OpenSearchSearchResponse
- OpeningHours
- Parsing
- Phoneme
- PhonemesSection
- QueryTermResultItem
- Range
- Scoring
- StructuredOpeningHours
- Supplier
- SupplierReference
- TitleAndAddressHighlighting
- TitleHighlighting
Authorization
apiKey
- Type: API key
- API key parameter name: apiKey
- Location: URL query string
bearerAuth
- Type: Bearer authentication (JWT)
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.59
- Build package:
org.openapitools.codegen.languages.PhpClientCodegen