dev-master
9999999-devSymfony 3 Bundle for Twig Filter Extension to read JSON file or through URL
MIT
The Development Requires
by Hidayat sagita
twig json bundle symfony
Wallogit.com
2017 © Pedro Peláez
Symfony 3 Bundle for Twig Filter Extension to read JSON file or through URL
Symfony Bundle for Twig Filter Extension to read local JSON file or directly through URL., (*1)
Make sure you have installed Composer globally in your system. Then go to your terminal, inside your Symfony project run following command :, (*2)
composer require hdytsgt/twigson-bundle:dev-master
When composer done installing the bundle, go to your app/AppKernel.php and add following Class new hdytsgt\TwigsonBundle\TwigsonBundle() into registerBundles() , example :, (*3)
public function registerBundles()
{
$bundles = [
...
new hdytsgt\TwigsonBundle\TwigsonBundle(),
];
}
Using local JSON file :, (*4)
{% set json = './countries.json' | twigson %}
{% for key, item in json %}
{{ key }} : {{ item }}
{% endfor %}
This will find countries.json under your Symfony web folder. And of course you can pass absolute path too., (*5)
, (*6)
Using URL :, (*7)
{% set json = 'http://yoursite.com/countries.json' | twigson %}
{% for key, item in json %}
{{ key }} : {{ item }}
{% endfor %}
, (*8)
Twigson for Craft CMS, (*9)
MIT, (*10)
Symfony 3 Bundle for Twig Filter Extension to read JSON file or through URL
MIT
twig json bundle symfony