LocationIQ provides flexible enterprise-grade location based solutions. We work with developers, startups and enterprises worldwide serving billions of requests everyday. This page provides an overview of the technical aspects of our API and will help you get started.
This PHP package is automatically generated by the OpenAPI Generator project:
- API version: 1.0.1
- Package version: 1.0.1
- Build package: org.openapitools.codegen.languages.PhpClientCodegen
PHP 5.5 and later
To install the bindings via Composer, add the following to composer.json:
{
"repositories": [
{
"type": "git",
"url": "https://github.com/location-iq/locationiq-php-client.git"
}
],
"require": {
"location-iq/locationiq-php-client": "*@dev"
}
}
Then run composer install
Download the files and include autoload.php:
require_once('/path/to/locationiq/vendor/autoload.php');To run the unit tests:
composer install
./vendor/bin/phpunit
Please follow the installation procedure and then run the following:
<?php
require_once(__DIR__ . '/vendor/autoload.php');
// Configure API key authorization: key
$config = LocationIq\Configuration::getDefaultConfiguration()->setApiKey('key', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = LocationIq\Configuration::getDefaultConfiguration()->setApiKeyPrefix('key', 'Bearer');
$apiInstance = new LocationIq\Api\BalanceApi(
// 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
);
try {
$result = $apiInstance->balance();
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling BalanceApi->balance: ', $e->getMessage(), PHP_EOL;
}
?>All URIs are relative to https://eu1.locationiq.com/v1
| Class | Method | HTTP request | Description |
|---|---|---|---|
| BalanceApi | balance | GET /balance.php | |
| ReverseApi | reverse | GET /reverse.php | Reverse Geocoding |
| SearchApi | search | GET /search.php | Forward Geocoding |
- Type: API key
- API key parameter name: key
- Location: URL query string