Download the PHP package / without Composer

On this page you can find all versions of the php package /. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?
/
Rate from 1 - 5
Rated 5.00 based on 2 reviews

Informations about the package

Contao Twig Support Bundle

Latest Stable Version Total Downloads CI Coverage Status

A bundle to enable extensive twig templates support in contao. Just activate the template loader and you can work with twig templates as they were .html5 templates. This means, you can select twig templates in the custom template select in the contao backend and you can override any template in your project template folder or in a bundle. As a developer, you can use this bundle to work with twig templates like with contao templates, e.g. use simple template names, template groups and rely on the contao template hierarchy.

Features

Usage

Setup

Install via contao manager or composer:

composer require heimrichhannot/contao-twig-support-bundle

Your first template

  1. If you want to use this bundle to enable contao to support twig templates, you need to enable the template loader. You just need to add following configuration entries to your config.yml:

  2. Now you can create every contao template as twig template. For example create a twig template ce_text_custom.html.twig and add it to your projekt templates folder (in contao 4.4: app/Resources/views). Now you can select the template as custom Template in the text content element (maybe you need to clear the cache before). You can override every core template that is parsed by parseTemplate and parseWidget hook. You can also add templates from bundles (just place them in src/Resources/views).

Widgets

As already written, this bundle also allows overriding widget templates. Since twig templates are not rendered in the default widget/template scope as contao templates, you can't use $this to get variables. Instead, twig support bundle passes the widget instance, so you can use the widget object to get the variable content, for example {{ widget.name }} or {{ widget.class }}.

Twig and contao cavets

User input is encoded by contao, so you need to add the raw filter to variables if you need to output html.

Use project templates folder for twig templates in contao 4.4

If you want to use the project templates folder also in contao 4.4, just add following lines to your config.yml:

Skip templates

It may the be case, that other bundle comes with twig templates that are incompatible with core template but have the same name. Or you don't want to process some templates as twig templates. In this case you can add them to the skip templates configuration:

There is also a SkipTemplateException that could be thrown in the BeforeParseTwigTemplateEvent to skip a template.

Developers

Events

Event Description
BeforeParseTwigTemplateEvent Dispatched after twig templates was found. Throw a SkipTemplateException to skip the curent template to be processed as twig template.
BeforeRenderTwigTemplate Dispatched before twig templates is rendered.

Use twig in your bundle

This bundle is a great base if you want to use twig in your own bundles.

Template locator

Use the TwigTemplateLocator service to load your templates, where you need them while keeping the contao template hierarchy (you can override a bundle template in your project template folder or in another bundle which is loaded after the bundle).

Get all Templates with prefix (like Controller::getTemplateGroup): TwigTemplateLocator::getTemplateGroup()

Get the twig path from an template name:

Template renderer

Use the TwigTemplateRenderer service to render a template by template name. The renderer adds template comments in dev mode as contao does for html5 templates. There are additional config options to customize the renderer or render a specific twig template instead of using the template locator to get the correct path to an template name. If you need to add specific logic applied before or after rendering, we recommend to decorate the service.

TwigFrontendTemplate

You can use the TwigFrontendTemplate class to work with a twig template as it's a normal contao frontend template object. It inherits from the contao FrontendTemplate class and can be used to render twig template in contao context and use all hooks and template class functions.

Configuration reference

Credits


All versions of with dependencies

PHP Build Version
Package Version
No informations.
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package / contains the following files

Loading the files please wait ....