adrianheras/amount-symbol

Amount symbol Twig extension where you can easily add symbol to amounts like currencies and percentages

1.0 2015-05-12 19:42 UTC

This package is not auto-updated.

Last update: 2024-12-21 19:02:51 UTC


README

This is a Twig extension for Symfony2 Framework where you can easily add symbol to amounts like currencies and percentages.

For example

{{ merkat.cash|amount_symbol("EUR") }}

Outputs 70.95 €

Installation for Symfony2

  1. Update your composer.json
"require": {
	"adrianheras/amount-symbol": "1.*"
}

or use composer's require command:

composer require adrianheras/amount-symbol:1.*
  1. Register an Extension as a Service

Now you must let the Service Container know about your newly created Twig Extension:

YAML:

# app/config/config.yml
services:
	adrianheras.twig.amount_symbol:
		class: AdrianHeras\Twig\Extension\AmountSymbolExtension
		tags:
		- { name: twig.extension }

XML:

# or into your bundle src\Acme\AcmeBundle\Resources\config\services.xml

<service id="adrianheras.twig.amount_symbol" class="AdrianHeras\Twig\Extension\AmountSymbolExtension">
	<tag name="twig.extension" />
</service>