yii2-googleplacesautocomplete
Google Places Auto Complete widget for Yii2, (*1)
Installation
Add below to your composer.json
file, (*2)
"repositories": [
{
"type": "vcs",
"url": "https://github.com/petrabarus/yii2-googleplacesautocomplete"
}
],
"requires": {
"petrabarus/yii2-googleplacesautocomplete": "*"
}
Usage
Using widget and model., (*3)
use PetraBarus\Yii2\GooglePlacesAutoComplete\GooglePlacesAutoComplete;
echo GooglePlacesAutoComplete::widget([
'model' => $model,
'attribute' => 'location'
]);
Using widget for custom field name and value., (*4)
use PetraBarus\Yii2\GooglePlacesAutoComplete\GooglePlacesAutoComplete;
echo GooglePlacesAutoComplete::widget([
'name' => 'place'
'value' => 'Jakarta'
]);
Using active form., (*5)
use yii\bootstrap\ActiveForm;
use PetraBarus\Yii2\GooglePlacesAutoComplete\GooglePlacesAutoComplete;
echo $form = ActiveForm::begin();
echo $form->field($model, 'location')->widget(GooglePlacesAutoComplete::className());