library google-maps-services-php
Google maps web services php client.
dan-har/google-maps-services-php
Google maps web services php client.
- Sunday, February 4, 2018
- by danhar
- Repository
- 1 Watchers
- 0 Stars
- 8 Installations
- PHP
- 1 Dependents
- 0 Suggesters
- 0 Forks
- 0 Open issues
- 2 Versions
- 14 % Grown
google-maps-services-php
PHP client for google maps api service., (*1)
Installation
Install using composer, (*2)
composer require dan-har/google-maps-services-php
Usage
$placesService = new PlacesApi(new Client(), Auth::fromKey('GOOGLE_API_KEY'));
$placeId = 'ChIJN1t_tDeuEmsRUsoyG83frY4';
try {
$placeResponse = $placesService->details($placeId);
} catch (ResourceRequestException $e) {
// handle request exception, for example caused by timeout
}
// check if the response is ok, if so we have a result for the place id
if( ! $placeResponse->isOk()) {
// handle request failure, for example no results, wrong place id etc.
}
$result = $placeResponse->result();
// check for address component
foreach($result->addressComponents as $addressComponent) {
if($addressComponent->isType(AddressType::LOCALITY)) {
//
}
}
// get the geometry object.
$geometry = $result->geometry;
dev-master
9999999-dev
Google maps web services php client.
Sources
Download
MIT
The Requires
The Development Requires
by
Dan Har
0.1.0
0.1.0.0
Google maps web services php client.
Sources
Download
MIT
The Requires
The Development Requires
by
Dan Har