1. Go to this page and download the library: Download lajosbencz/here-php library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
lajosbencz / here-php example snippets
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;
}