PHP code example of stesi / yii2-select-google-map-location
1. Go to this page and download the library: Download stesi/yii2-select-google-map-location 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/ */
stesi / yii2-select-google-map-location example snippets
class SearchLocation extends \yii\base\Model
{
...
public $address;
public $longitude;
public $latitude;
...
}
$model = new SearchLocation();
$form = \yii\widgets\ActiveForm::begin();
...
$form->field($model, 'address')->widget(\kalyabin\maplocation\SelectMapLocationWidget::className(), [
'attributeLatitude' => 'latitude',
'attributeLongitude' => 'longitude',
'googleMapApiKey' => '<YOUR_REGISTERED_GOOGLE_MAP_API>',
]);
...
\yii\widgets\ActiveForm::end();