PHP code example of davidhirtz / yii2-location-google

1. Go to this page and download the library: Download davidhirtz/yii2-location-google 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/ */

    

davidhirtz / yii2-location-google example snippets


// config/params.php
return [
    'googleApiKey' => '...',
];

// config/web.php
'container' => [
    'definitions' => [
        \Hirtz\Location\Google\Components\GoogleMapsApi::class => [
            'supportedLanguageCodes' => ['de' => 'de', 'en-US' => 'en', 'it' => 'it'],
        ],
    ],
],

'modules' => [
    'admin' => [
        'modules' => [
            'location' => [
                'components' => [
                    'autocomplete' => [
                        'class' => \Hirtz\Location\Google\Components\Autocomplete::class,
                        'options' => ['json' => ['

'container' => [
    'definitions' => [
        \Hirtz\Location\Google\Components\PlaceDetails::class => [
            'fields' => ['id', 'formattedAddress', 'addressComponents', 'location'],
        ],
    ],
],