Download the PHP package derekderaps/twigshim without Composer

On this page you can find all versions of the php package derekderaps/twigshim. 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?

Informations about the package twigshim

Twigshim

Shoehorns Twig template compiling into Drupal 7. Especially useful when you already have twig templates rendering your components in another system (e.g., an external styleguide) and don't want to re-implement everything in PHPTemplate.

Installation

Download the Twig library

This project depends on the Twig PHP library, which can be installed one of three ways:

  1. Composer Manager* (recommended)
  2. Composer
  3. Libraries API*

via Composer Manager

This is the recommended installation method. Install the Composer Manager module* and follow its installation instructions to generate your composer.json and download your vendor dependencies. No extra work is required beyond the steps outlined in the Composer Manager project.

or via Composer

Follow the installation instructions for the main Composer project, then cd into this module's directory (probably sites/all/modules/contrib/twigshim) and run composer install.

or via Libraries API

Install the Libraries API module* and download the Twig library into your libraries directory (probably sites/all/libraries).

Install the Twig Shim module

Follow the normal Drupal module installation procedure.*


*For instructions on installing Drupal modules, see the Drupal.org documention.

Usage

If your templates live anywhere other than in the templates subdirectory of your default theme, visit /admin/conig/development/twigshim and set the appropriate path. All your template references resolve relative to this path. Do not include leading or trailing slashes.

The main Twig Shim function is twigshim_render(). Call this with your template path (relative to the templates directory you just set) and an optional array of variables to be used in the template. Example:

When rendering an entity, use the helper function twigshim_render_entity() to automatically pull each of the entity's fields and properties into the variables array. It strips field_ from the front of each key, facilitating the re-use of variables across both your style guide and implementation.

Note that it is the caller's responsibility to properly sanitize all variables before passing into Twig Shim. See the Drupal.org documentation on writing secure code and the sanitisation functions.


All versions of twigshim with dependencies

PHP Build Version
Package Version
Requires twig/twig Version ~1.29
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 derekderaps/twigshim contains the following files

Loading the files please wait ....