Symfony2 AddressBundle

v1.1.7 2015-12-01 13:20 UTC


Build Status Coverage Status Scrutinizer Quality Score SensioLabsInsight Latest Stable Version Total Downloads Latest Unstable Version License

1.1 Composer

"require": {
    "padam87/address-bundle": "~1.0"

1.2 BazingaGeocoderBundle

Install BazingaGeocoderBundle

1.3 AppKernel

// app/AppKernel.php
public function registerBundles()
    return array(
        // ...
        new Padam87\AddressBundle\Padam87AddressBundle(),

1.4 doctrine:schema:update

Update Your schema

2, Usage

You can create a relation to one of the Entities, or you can use one of the traits.

2.1 Formatter

$formatted = $this->get("padam87.address.formatter")->format($address);


use Padam87\AddressBundle\Service\FormatterService;


$formatted = $this->get("padam87.address.formatter")->format($address, FormatterService::FLAG_NOBR);

Available flags

FLAG_NOBR No linebreak will be added

FLAG_HTML Outputs the address in html format

FLAG_NOCASE No case change will be applied

2.2 Twig extension

{{ address|address()|raw }}

This will output the formatted address, with the FLAG_HTML added by default

2.3 Geocoding

$address = new GeocodedAddress();

The listener will take care of the rest ;)