PHP code example of puwnz / google-maps-bundle

1. Go to this page and download the library: Download puwnz/google-maps-bundle 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/ */

    

puwnz / google-maps-bundle example snippets



// config/bundles.php

return [
    Puwnz\GoogleMapsBundle\GoogleMapsBundle::class => ['all' => true]
];



namespace App\Controller;

use Puwnz\GoogleMapsBundle\Service\GoogleService;
use Puwnz\GoogleMapsLib\Geocode\DTO\GeocodeResult;

class FooService  {

    /** @var GoogleService */
    private $googleService;

    public function __construct(GoogleService $geocodeService) {
        $this->googleService = $geocodeService;
    }
    
    /**
    * @return GeocodeResult[]
    */
    public function getGeocodeResult(string $address) : array
    {
        return $this->googleService->geocode($address);
    }
}