zibun / google-maps-provider
Geocoder GoogleMaps adapter
4.4.0
2019-04-26 20:17 UTC
Requires
- php: ^7.0
- geocoder-php/common-http: ^4.0
- willdurand/geocoder: ^4.0
Requires (Dev)
- geocoder-php/provider-integration-tests: ^1.0
- php-http/curl-client: ^1.7
- php-http/message: ^1.0
- phpunit/phpunit: ^6.5 || ^7.5
Provides
This package is auto-updated.
Last update: 2024-10-08 08:08:01 UTC
README
This is the Google Maps provider from the PHP Geocoder. This is a READ ONLY repository. See the main repo for information and documentation.
Usage
$httpClient = new \Http\Adapter\Guzzle6\Client(); // You must provide an API key $provider = new \Geocoder\Provider\GoogleMaps\GoogleMaps($httpClient, null, 'your-api-key'); $result = $geocoder->geocodeQuery(GeocodeQuery::create('Buckingham Palace, London'));
All requests require a valid API key, however google does have a free tier available. Please see this page for information on getting an API key.
Google Maps for Business
Previously, google offered a "Business" version of their APIs. The service has been deprecated, however existing clients
can use the static business
method on the provider to create a client:
$httpClient = new \Http\Adapter\Guzzle6\Client(); // Client ID is required. Private key is optional. $provider = \Geocoder\Provider\GoogleMaps\GoogleMaps::business($httpClient, 'your-client-id', 'your-private-key'); $result = $geocoder->geocodeQuery(GeocodeQuery::create('Buckingham Palace, London'));
Install
composer require geocoder-php/google-maps-provider
Contribute
Contributions are very welcome! Send a pull request to the main repository or report any issues you find on the issue tracker.