alaczi / twig-country-extension
Twig country filter extension for twig
Installs: 49 127
Dependents: 0
Suggesters: 0
Security: 0
Stars: 5
Watchers: 0
Forks: 2
Open Issues: 0
Requires
- php: >=5.3.0
- symfony/intl: ~2.3|~3.0|^4.0
- twig/twig: ~1.15|^2.0
This package is auto-updated.
Last update: 2024-10-25 22:33:12 UTC
README
Require as dependency
composer require alaczi/twig-country-extension
Register the extension
PHP
$filter = new \alaczi\Twig\Extension\CountryExtension(); $twig = new Twig_Environment($loader); $twig->addFilter($filter);
Symfony 2
services: alaczi.twig.country_extension: class: alaczi\Twig\Extension\CountryExtension tags: - { name: twig.extension }
Silex
$app['twig'] = $app->share($app->extend('twig', function ($twig, $app) { /** @var \Twig_Environment $twig */ $twig->addExtension(new \alaczi\Twig\Extension\CountryExtension()) return $twig; }));
Usage in twig
{{ countryCode|country }}