Download the PHP package alanrodas/twig-view without Composer

On this page you can find all versions of the php package alanrodas/twig-view. 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 twig-view

TwigView plugin for CakePHP

Build Status Latest Stable Version Total Downloads Coverage Status Bitdeli Badge

This plugin for the CakePHP Framework allows you to use the Twig Templating Language for your views.

In addition to enabling the use of most of Twig's features, the plugin is tightly integrated with the CakePHP view renderer giving you full access to helpers, objects and elements.

Installation

Make sure you have composer installed and configured with the autoloader registering during bootstrap as described here. Make sure you have a composer.json and add the following to your required section.

Cache Permissions

Make the default view-cache folder writeable.

APP/Plugin/TwigView/tmp/views

Alternatively: Set where you want cache files to be stored.

Using the View Class

To make CakePHP aware of TwigView edit your APP/Controller/AppController.php file and add the following:

Be sure to load the TwigView plugin in your bootstrap.php file with:

or:

Now start creating view files using the .tpl extension.

Default Layouts

This plugin comes with all default layouts converted to Twig. Examples can be found in:

APP/Plugin/TwigView/examples

Themes

The plugin has support for themes and works just like the Theme view. Simply add the $theme property to your controller and you're set.

This will cause the view to also look in the Themed folder for templates. In the above example templates in the following directory are favored over their non-themed version.

APP/View/Themed/Rockstar/

If you, for example, want to overwrite the Layouts/default.tpl file in the Rockstar theme, then create this file:

APP/View/Themed/Rockstar/Layouts/default.tpl

Using Helpers inside Templates

All helper objects are available inside a view and can be used like any other variable inside Twig.

... where ...

Which is the equivalent of writing:

A more complex example, FormHelper inputs:

Referencing View Elements

Elements must be .tpl files and are parsed as Twig templates. Using .ctp is not possible.

In exchange for this limitation you can import elements as easy as this:

Translating Strings

The trans filter can be used on any string and simply takes the preceding string and passes it through the __() function.

`

This is the equivalent of writing:

Translating multiple lines

The trans-block element will help you with that. This is especially useful when writing email templates using Twig.

Accessing View Instance

In some cases it is useful to access $this, for example to build a DOM id from the current controller and action name.

The object is accessible through _view.

Precompiling all templates

Twig has to compile all the templates before they can be used. This adds a one time per template delay to the loading of a page. This can be countered by using the Compile Templates shell command. This commands scans for all the templates and compiles them with Twig for caching and performence gains.


All versions of twig-view with dependencies

PHP Build Version
Package Version
Requires php Version >=5.2.4
twig/twig Version 1.*
composer/installers Version *
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 alanrodas/twig-view contains the following files

Loading the files please wait ....