2017 © Pedro Peláez
 

symfony-bundle google-map-display-bundle

Provides a way to display google maps from address(es) (w/ the javascript API), the most minimalist, unobtrusive way possible.

image

cethyworks/google-map-display-bundle

Provides a way to display google maps from address(es) (w/ the javascript API), the most minimalist, unobtrusive way possible.

  • Wednesday, August 9, 2017
  • by Cethy
  • Repository
  • 1 Watchers
  • 0 Stars
  • 282 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 4 Versions
  • 0 % Grown

The README.md

Cethyworks\GoogleMapDisplayBundle

Provides a way to display google maps from address(es) (w/ the javascript API), the most minimalist, unobtrusive way possible., (*1)

CircleCI, (*2)

Install

1. Composer require, (*3)

$ composer require cethyworks/google-map-display-bundle 

2. Register bundles, (*4)

// AppKernel.php
class AppKernel extends Kernel
{
    public function registerBundles()
    {
        $bundles = [
            // ...
            new Cethyworks\ContentInjectorBundle\CethyworksContentInjectorBundle(),
            new Cethyworks\GooglePlaceAutocompleteBundle\CethyworksGooglePlaceAutocompleteBundle(),
        ];
        // ...

How to use

1. Update (optionally) your config.yml with :, (*5)

cethyworks_google_map_display:
    google:
        api_key: 'your_api_key'

2. Call the handler to add maps :, (*6)

// retrieve the command handler
/** @var GoogleMapDisplayCommandHandler $handler */
$commandHandler = $container->get(GoogleMapDisplayCommandHandler::class);
// add address & html id to display the map
$commandHandler->addMap('map_id', 'address 1');
// optionnally add other maps 
// $commandHandler->addMap('map2', 'address 2');
// ...

4. Done ! (the handler register automatically the Command), (*7)

How it works

The ContentInjectorSubscriber will inject the template containing the javascript code (with mapIds, addresses & the google api_key) into the Response automatically., (*8)

Additional information

Cethyworks\ContentInjectorBundle, (*9)

Google Map JS API Documentation, (*10)

The Versions