2017 © Pedro Peláez
 

library silex-twig-country-extension

Twig country filter extension for silex

image

nymo/silex-twig-country-extension

Twig country filter extension for silex

  • Friday, April 13, 2018
  • by nymo
  • Repository
  • 1 Watchers
  • 3 Stars
  • 2,953 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 4 Versions
  • 0 % Grown

The README.md

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

Packagist Monthly Downloads Build Status Coverage Status, (*1)

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., (*2)

Requirements

This extension was created for Silex and Twig Template Engine, (*3)

Installation

Via composer:

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

Usage

load twig template engine

First you have to register the twig template engine in your silex application, (*4)

$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] (http://silex.sensiolabs.org/doc/providers/twig.html), (*5)

add new extension to twig

As a next step you can retreive the twig service from your app container and register the country extension., (*6)

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

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)., (*7)

<h1>You're living in {{ foo.country|country }}</h1>

The Versions

13/04 2018

dev-master

9999999-dev http://github.com/nymo/silex-twig-country-extension

Twig country filter extension for silex

  Sources   Download

MIT

The Requires

 

The Development Requires

twig extension filter silex country

15/01 2017

v1.0.1

1.0.1.0 http://github.com/nymo/silex-twig-country-extension

Twig country filter extension for silex

  Sources   Download

MIT

The Requires

 

The Development Requires

twig extension filter silex country

15/01 2017

dev-add-testsuite

dev-add-testsuite http://github.com/nymo/silex-twig-country-extension

Twig country filter extension for silex

  Sources   Download

MIT

The Requires

 

The Development Requires

twig extension filter silex country

17/03 2014

v1.0.0

1.0.0.0 http://github.com/nymo/silex-twig-country-extension

Twig country filter extension for silex

  Sources   Download

MIT

The Requires

 

twig extension filter silex country