2017 © Pedro Peláez
 

library csv4twig

A CSV escaping filter for the Twig templating engine.

image

mbaynton/csv4twig

A CSV escaping filter for the Twig templating engine.

  • Friday, October 21, 2016
  • by mbaynton
  • Repository
  • 1 Watchers
  • 1 Stars
  • 3,255 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 37 % Grown

The README.md

CSV4Twig

CSV escaping filter for the Twig templating engine

Build Status, (*1)

CSV4Twig enables Twig templates to generate safe, properly-escaped CSV output. It's useful when you need to get CSV reports out of an existing application that has a Twig-enabled output layer., (*2)

Usage

  1. Add it to your project with composer:
    composer require mbaynton/csv4twig:1.0.*
  2. Tell Twig about it. You'll need to get a hold of the \Twig_Environment instance that will generate the CSV; then just pass it to \mbaynton\CSV4Twig\Filter::registerFilters().
  3. Use it in your template with the autoescape tag:, (*3)

    {% autoescape "csv" %}
    {{ some_value }},{{ another_value }}
    {% endautoescape %}
    

    The contents of some_value and another_value will be escaped using the default CSV-escaping conventions of PHP's fputcsv() function. fputcsv() is the function this filter uses internally., (*4)

    If you prefer, you can also escape certain values explicitly:, (*5)

    {% autoescape false %}
    {{ some_value|e("csv") }},{{ another_value }}
    {% endautoescape %}
    

    That's it!, (*6)

The Versions

21/10 2016

dev-master

9999999-dev

A CSV escaping filter for the Twig templating engine.

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

by Mike Baynton

templating

20/10 2016

1.0.1

1.0.1.0

A CSV escaping filter for the Twig templating engine.

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

by Mike Baynton