PHP code example of 2amigos / yii2-google-places-library
1. Go to this page and download the library: Download 2amigos/yii2-google-places-library 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/ */
2amigos / yii2-google-places-library example snippets
'components' => [
'places' => [
'class' => '\dosamigos\google\places\Places',
'key' => '{your-google-api-key-with-places-activated}',
'format' => 'json', // or 'xml'
'forceJsonArrayResponse' => true // for decoding responses to arrays instead of objects
],
'placesSearch' => [
'class' => '\dosamigos\google\places\Search',
'key' => '{your-google-api-key-with-places-activated}',
'format' => 'json' // or 'xml'
]
]
// If you setup the format in 'json', the returned value will be an array. If 'xml', it will return a SimpleXmlElement.
var_dump(Yii::$app->search->text('restaurants in Inca Mallorca'));