Skip to content
A Kohana module for integrating Twig
PHP
Pull request Compare This branch is 22 commits ahead, 1 commit behind icyleaf:3.2/develop.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
classes
config
guide/kohana-twig
vendor
.arcconfig
.gitmodules
README.md
init.php

README.md

Twig Module

From twig-project.org

Fast: Twig compiles templates down to plain optimized PHP code. The overhead compared to regular PHP code was reduced to the very minimum.

Secure: Twig has a sandbox mode to evaluate untrusted template code. This allows Twig to be used as a templating language for applications where users may modify the template design.

Flexible: Twig is powered by a flexible lexer and parser. This allows the developer to define its own custom tags and filters, and create its own DSL.

Credit goes to Jonathan Geiger and John Heathco for creating the original modules. This fork contains the following improvements.

  • Sandbox configuration
  • Syntax 〃
  • Kohana template loader. Now templates aren't restricted to one directory
  • Updated to follow the Kohana convention

Installation

  1. git submodule add git://github.com/nexeck/kohana-twig.git modules/twig
  2. cd modules/twig && git submodule update --init
  3. Enable twig in your bootstrap.php file
  4. Extend Controller

Usage

Pretty similar to using the Controller_Template class.

class Controller_Example extends Controller
{
  // Template names are generated automatically if not specified. So this
  // action would map to: example/index.html
  public function action_index()
  {
    $this->variable = "Hello World";
  }
}

Not Happy?

file a bug report

Something went wrong with that request. Please try again.