happyr/location-bundle

A Symfony2 Bundle to handle geographic location of your entities

Installs: 5 146

Dependents: 0

Suggesters: 0

Security: 0

Stars: 4

Watchers: 3

Forks: 0

Open Issues: 0

Type:symfony-bundle

0.5.3 2020-11-11 10:57 UTC

This package is auto-updated.

Last update: 2024-04-11 18:17:45 UTC


README

A Symfony2 Bundle to handle locations. This provided a Locaiton object with differnet parts to clearly identify a location.

Installation

1. Install with composer:

php composer.phar require happyr/location-bundle

2. Enable the bundle:

// app/AppKernel.php

public function registerBundles()
{
    $bundles = array(
        // ...
        new Happyr\LocationBundle\HappyrLocationBundle(),
    );
}

3. Add a geocoder

You need to specify a geocoder service to in the coniguration. The geoder must inplement the GeocoderInterface

happyr_location:
    geocoder_service: 'acme.geocoder'

Usage

//any form 
public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder
            ->add('location', 'location', array(
                    'components'=>array(
                        'country'=>true,
                        'city'=>true,
                    )
                ));
    }