Download the PHP package kaliop/twig-express-bundle without Composer
On this page you can find all versions of the php package kaliop/twig-express-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download kaliop/twig-express-bundle
More information about kaliop/twig-express-bundle
Files in kaliop/twig-express-bundle
Package twig-express-bundle
Short Description Browse and render “static” Twig templates from bundles in a Symfony project. This bundle is a port of the TwigExpress tool, and is intended for private front-end prototypes, not public-facing pages.
License MIT
Informations about the package twig-express-bundle
KaliopTwigExpressBundle
Browse and render “static” Twig templates in a Symfony project. This bundle is a port of the TwigExpress standalone tool, and is intended for private front-end prototypes. You might like it if you’re a designer or front-end developer working with Symfony. Do not use this bundle or its routes in production!
Features
- Gives access to the Twig templates in the
Resources/views/static
folder of a bundle, showing index pages for this folder and subfolders. (Note that the root folder can be changed for each bundle.) - Renders Twig templates, and reports Twig errors with an extract of the faulty template.
Important: this bundle’s controller will not be able to render templates that depend on data provided by other existing controllers. It’s intended for “static” prototypes which don’t depend on any data from databases or services.
Installation
Install with Composer in your Symfony project:
Then you will need to register this bundle in app/AppKernel.php
. This may look like:
Getting started
Let’s say you have a bundle named MyAwesomeBundle
and which contains “static” Twig templates in MyAwesomeBundle/Resources/views/static
. By “static” Twig templates, we mean templates which do not depend on data provided by a controller. It could be simple HTML pages with {% include %}
tags and other native Twig features.
First you will need to activate the TwigExpress routes. Add this to your routing config (for example in routing_dev.yml
):
Then, in your main config (for example in config_dev.yml
), tell KaliopTwigExpressBundle that it can render templates from your bundle:
Finally, navigate to http://[your-hostname]/static/
to explore your static views. You should be able to explore and render the Twig templates from MyAwesomeBundle/Resources/views/static
.
Demo pages
This bundle contains its own demo static
templates, which demonstrate a few added features. To activate it, add this import to your config_dev.yml
:
Advanced configuration
For each bundle, instead of providing the bundle’s name only, you can change the URL slug (the part that identifies this bundle in the URL) and the path to the bundle’s “static” templates:
If you would like to use a different URL base than /static/…
, use the twig_express.url_base
parameter:
All versions of twig-express-bundle with dependencies
symfony/symfony Version >=2.5
twig/twig Version >=1.18
joshtronic/php-loremipsum Version ^1.0
erusev/parsedown Version ^1.6