composer require padam87/address-bundle
// app/AppKernel.php
public function registerBundles()
{
return array(
// ...
new Padam87\AddressBundle\Padam87AddressBundle(),
);
}
Use the traits and embeddables with your schema.
$formatted = $this->get("padam87.address.formatter")->format($address);
use Padam87\AddressBundle\Service\FormatterService;
//...
$formatted = $this->get("padam87.address.formatter")->format($address, FormatterService::FLAG_NOBR);
FLAG_NOBR
No linebreak will be addedFLAG_HTML
Outputs the address in html format
You can override or extend the language-specific formats. Just create the appropriate template under app\Resources\Padam87AddressBundle\views
example: app\Resources\Padam87AddressBundle\views\US.twig
contributing: Create a PR with your own country's format :)
{{ address|address()|raw }}
This will output the formatted address, with the FLAG_HTML
added by default