2017 © Pedro Peláez
 

library twig-extensions

A few handy extensions for Twig.

image

allmarkedup/twig-extensions

A few handy extensions for Twig.

  • Thursday, October 30, 2014
  • by allmarkedup
  • Repository
  • 0 Watchers
  • 1 Stars
  • 9,420 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 2 % Grown

The README.md

Twig Extensions

A few handy extensions for Twig., (*1)

Included extensions:, (*2)

Installation and use

Using composer:, (*3)

$ composer require allmarkedup/twig-extensions

Then load the required extension(s) into the Twig environment when setting it up as per the instructions in the Twig docs. For example, to use the Markdown extension, you would use something like this:, (*4)

<?php
use Amu\Twig\TwigMarkdownExtension as MarkdownExtension;
//...
$twig = new Twig_Environment($loader, $options);
$twig->addExtension(new MarkdownExtension());

Included extensions

Markdown Extension

The Markdown extension uses Parsedown under the hood to allow for easy Markdown -> HTML conversion in your templates., (*5)

To install:, (*6)

<?php
$twig->addExtension(new Amu\Twig\TwigMarkdownExtension());

Use it in your templates as a filter:, (*7)

{{ 'This is a **string**' | markdown }}

Or use it as a tag:, (*8)

{% markdown %}
_This sentence is emphasised_
> And this is a quote.
{% endmarkdown %}

Running tests

Tests can be run using PHP Unit:, (*9)

$ vendor/bin/phpunit 

The project also includes a Grunt watch task to run the PHP Unit tests when files are updated which you can use for your convenience., (*10)

The Versions

30/10 2014

dev-master

9999999-dev

A few handy extensions for Twig.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Mark Perkins

30/10 2014

v0.2

0.2.0.0

A few handy extensions for Twig.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Mark Perkins

27/10 2014

v0.1

0.1.0.0

A few handy extensions for Twig.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Mark Perkins