Download the PHP package dsawardekar/wordpress-twig-helper without Composer
On this page you can find all versions of the php package dsawardekar/wordpress-twig-helper. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download dsawardekar/wordpress-twig-helper
More information about dsawardekar/wordpress-twig-helper
Files in dsawardekar/wordpress-twig-helper
Package wordpress-twig-helper
Short Description Helpers for using Twig with WordPress
License MIT
Homepage http://github.com/dsawardekar/wordpress-twig-helper
Informations about the package wordpress-twig-helper
WordPress Twig Helper

A tiny Library for using Twig Templates in WordPress Plugins & Themes.
Deprecated. This repo has been merged into Arrow.
Usage
The WpTwigHelper\TwigHelper
is a helper class that provides the bulk of
the functionality.
First give the TwigHelper
a base directory. This will usually
correspond to your plugin or theme directory. It must contain a
templates
sub directory that contains the .twig
templates.
Then if you have the template hello.twig
in the templates
directory
with the contents,
You can render the template with the render
method. It returns the
output of rendering the twig template. Use the display
method to echo
the output instead.
Precompiling Templates
You can optionally precompile the templates using the provided command
line tool, twig_compile
. It takes the source directories to compile
and the destination to put the compiled twig templates into.
This command can be added to your build process.
By default the TwigHelper
looks for compiled templates in the
dist/templates
directory. If present the Twig compilation phase is skipped.
This will speed up rendering of your templates as it's equivalent to
using inline PHP.
When dist/templates
is absent caching is turned off instead.
System Requirements
- Same as Twig, ie:- PHP 5.3.2+
License
MIT License. Copyright © 2014 Darshan Sawardekar.