PHPackages                             nymo/silex-twig-country-extension - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Templating &amp; Views](/categories/templating)
4. /
5. nymo/silex-twig-country-extension

AbandonedArchivedLibrary[Templating &amp; Views](/categories/templating)

nymo/silex-twig-country-extension
=================================

Twig country filter extension for silex

v1.0.1(9y ago)33.0kMITPHPPHP &gt;=5.3.0

Since Mar 17Pushed 8y ago1 watchersCompare

[ Source](https://github.com/nymo/silex-twig-country-extension)[ Packagist](https://packagist.org/packages/nymo/silex-twig-country-extension)[ Docs](http://github.com/nymo/silex-twig-country-extension)[ RSS](/packages/nymo-silex-twig-country-extension/feed)WikiDiscussions master Synced 3w ago

READMEChangelogDependencies (5)Versions (4)Used By (0)

This extension is archived. No further development happens here. If you like to take this over please contact me.
=================================================================================================================

[](#this-extension-is-archived-no-further-development-happens-here-if-you-like-to-take-this-over-please-contact-me)

[![Packagist](https://camo.githubusercontent.com/15adffbd55ce2cc0815f2b458d9bb3eea2a90c1d4203e9e75d3fe21c8d6349c6/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6e796d6f2f73696c65782d747769672d636f756e7472792d657874656e73696f6e2e737667)](https://packagist.org/packages/nymo/silex-twig-country-extension)[![Monthly Downloads](https://camo.githubusercontent.com/5c0ea822345514f70888192c07159ad7092ce9f0a3aae62c169f1612f20f11bf/68747470733a2f2f706f7365722e707567782e6f72672f6e796d6f2f73696c65782d747769672d636f756e7472792d657874656e73696f6e2f642f6d6f6e74686c79)](https://packagist.org/packages/nymo/silex-twig-country-extension)[![Build Status](https://camo.githubusercontent.com/8fca795854468ddb4df21a276f65098b1c5f99d63820de154351b4b56545137d/68747470733a2f2f7472617669732d63692e6f72672f6e796d6f2f73696c65782d747769672d636f756e7472792d657874656e73696f6e2e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/nymo/silex-twig-country-extension)[![Coverage Status](https://camo.githubusercontent.com/b7fcf29ad273abce82f940666ec758b17cfa71c77777b8192122f39c6a9e48fe/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f6e796d6f2f73696c65782d747769672d636f756e7472792d657874656e73696f6e2f62616467652e737667)](https://coveralls.io/github/nymo/silex-twig-country-extension)

Twig filter country extension for Silex
---------------------------------------

[](#twig-filter-country-extension-for-silex)

This is an extension for Twig for use in Silex if you use forms with a country choice list from Symfony 2. The Symfony 2 form saves each country from the choice list with a two letter country code. In order to display the full country name in your twig template you can use this country filter. It takes the two letter country code and displays the country as a full name in your current locale.

### Requirements

[](#requirements)

This extension was created for Silex and Twig Template Engine

### Installation

[](#installation)

#### Via composer:

[](#via-composer)

```
require: "nymo/silex-twig-country-extension": "~1.0"
```

### Usage

[](#usage)

\####load twig template engine First you have to register the twig template engine in your silex application

```
$app->register(new Silex\Provider\TwigServiceProvider(), array(
        'twig.path' => 'your view path',
        'twig.options' => array(
            "cache" => 'your cache path'
        )
    ));
```

Read more about the configuration at the official \[docs\] ()

#### add new extension to twig

[](#add-new-extension-to-twig)

As a next step you can retreive the twig service from your app container and register the country extension.

```
$twig = $app['twig'];
$twig->addExtension(new \nymo\Twig\Extension\CountryExtension($app));
```

#### in your template

[](#in-your-template)

I assume that you have already saved data in your db or anywhere else and want now to display this data in your html side. For example you have the country letter code **de**. When using the filter from below you will receive **Germany** or **Deutschland**(depends on your current locale).

```
You're living in {{ foo.country|country }}

```

###  Health Score

30

—

LowBetter than 62% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity20

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity60

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~1034 days

Total

2

Last Release

3450d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/2171f50a86bbd5c63ba89b79c4ed3602db70974b07cea9204a53014603b5406a?d=identicon)[nymo](/maintainers/nymo)

---

Top Contributors

[![nymo](https://avatars.githubusercontent.com/u/884833?v=4)](https://github.com/nymo "nymo (7 commits)")

---

Tags

twigfilterextensionsilexcountry

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/nymo-silex-twig-country-extension/health.svg)

```
[![Health](https://phpackages.com/badges/nymo-silex-twig-country-extension/health.svg)](https://phpackages.com/packages/nymo-silex-twig-country-extension)
```

###  Alternatives

[symfony/ux-twig-component

Twig components for Symfony

21917.2M313](/packages/symfony-ux-twig-component)[symfony/ux-live-component

Live components for Symfony

1636.5M115](/packages/symfony-ux-live-component)[tales-from-a-dev/twig-tailwind-extra

A Twig extension for Tailwind

36982.8k12](/packages/tales-from-a-dev-twig-tailwind-extra)[symfony/ux-toolkit

A tool to easily create a design system in your Symfony app with customizable, well-crafted Twig components

1682.8k1](/packages/symfony-ux-toolkit)[umanit/twig-image-extension

An extension to facilitate the integration of responsive images' markup in Twig templates.

1043.8k](/packages/umanit-twig-image-extension)[mati365/ckeditor5-symfony

CKEditor 5 integration for Symfony

261.9k](/packages/mati365-ckeditor5-symfony)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
