Skip to content

adrianheras/amount-symbol

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Amount Symbol Twig extension

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>

About

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

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages