Extension library to interact with Google Places API
Hey! We are on TutsPlus, check out its tutorial about geolocation and google places
The preferred way to install this extension is through composer.
Either run
php composer.phar require "2amigos/yii2-google-places-library" "*"
or add
"2amigos/yii2-google-places-library" : "*"
to the require section of your application's composer.json
file.
Using Search
class:
$search = new Search(['key' => '{YOURGOOGLEAPIKEY}']);
// $this->format = 'xml'; // if you wish to handle XML responses (JSON is highly recommended)
// If you setup the format in 'xml', the returned value will be an array.
// The library will decode the response automatically
var_dump($search->text('restaurants in Inca Mallorca'));
Using Place
class:
$place = new Place(['key' => '{YOURGOOGLEAPIKEY}']);
// $this->format = 'xml'; // if you wish to handle XML responses (JSON is highly recommended)
$place->details('{REFERENCEIDOFPLACE}'));
For further information regarding the multiple parameters of Google Places please visit its API reference
Web development has never been so fun! www.2amigos.us