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.

Installs: 290

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 2

Forks: 0

Open Issues: 0

Type:symfony-bundle

v2.1 2017-08-09 03:57 UTC

This package is not auto-updated.

Last update: 2024-05-07 15:04:33 UTC


README

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

CircleCI

Install

1. Composer require

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

2. Register bundles

// 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 :

cethyworks_google_map_display:
    google:
        api_key: 'your_api_key'

2. Call the handler to add maps :

// 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)

How it works

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

Additional information

Cethyworks\ContentInjectorBundle

Google Map JS API Documentation