2017 © Pedro Peláez
 

library twigson-bundle

Symfony 3 Bundle for Twig Filter Extension to read JSON file or through URL

image

hdytsgt/twigson-bundle

Symfony 3 Bundle for Twig Filter Extension to read JSON file or through URL

  • Wednesday, August 3, 2016
  • by hdytsgt
  • Repository
  • 1 Watchers
  • 0 Stars
  • 6 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 20 % Grown

The README.md

Twigson

Symfony Bundle for Twig Filter Extension to read local JSON file or directly through URL., (*1)

Installation

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(),
        ];
}

Usage

  1. 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)

  2. 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)

License

MIT, (*10)

The Versions

03/08 2016

dev-master

9999999-dev

Symfony 3 Bundle for Twig Filter Extension to read JSON file or through URL

  Sources   Download

MIT

The Development Requires

by Hidayat sagita

twig json bundle symfony