2017 © Pedro Peláez
 

library twig-module

Twig module for Stratify

image

stratify/twig-module

Twig module for Stratify

  • Saturday, February 3, 2018
  • by mnapoli
  • Repository
  • 2 Watchers
  • 0 Stars
  • 315 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 11 Versions
  • 2 % Grown

The README.md

Twig module for Stratify

Pre-configuration for Twig to work with Stratify., (*1)

Installation

composer require stratify/twig-module

Then enable the stratify/twig-module module in your Stratify application., (*2)

Usage

The Twig_Environment instance is now injectable wherever dependency injection is available., (*3)

Example of a Stratify controller:, (*4)

function (Twig_Environment $twig) {
    return $twig->render('home.twig');
}

Configuration

The following configuration options can be customized if needed:, (*5)

  • twig.paths: Paths containing templates to register, (*6)

    'twig.paths' => add([
        __DIR__.'/../views',
    ]),
    

    Templates can then be rendered as foo.twig., (*7)

    Templates can also be namespaced, which can be useful for reusable modules:, (*8)

    'twig.paths' => add([
        'blog' => __DIR__.'/../views',
    ]),
    

    Templates can then be rendered as @blog/foo.twig., (*9)

  • twig.options: Twig options, (*10)

    'twig.options' => add([
        'strict_variables' => true,
    ]),
    
  • twig.globals: Global variables available in templates, (*11)

    'twig.globals' => add([
        'appName' => 'My super project',
        'debug' => get('debug'), // container parameters can be injected too
    ]),
    
  • twig.extensions: array of Twig extensions, (*12)

    'twig.extensions' => add([
        get(Twig_Extension_Profiler::class),
        get(My\Custom\TwigExtension::class),
    ]),
    

Recommended options for production:, (*13)

'twig.options' => [
    'cache' => /* cache directory */,
],

Recommended options for development:, (*14)

'twig.options' => [
    'debug' => true,
    'cache' => false,
    'strict_variables' => true,
],

The Versions

03/02 2018

dev-master

9999999-dev

Twig module for Stratify

  Sources   Download

MIT

The Requires

 

The Development Requires

03/02 2018

0.3.1

0.3.1.0

Twig module for Stratify

  Sources   Download

MIT

The Requires

 

The Development Requires

16/07 2017

0.3.0

0.3.0.0

Twig module for Stratify

  Sources   Download

MIT

The Requires

 

The Development Requires

09/04 2017

0.2.0

0.2.0.0

Twig module for Stratify

  Sources   Download

MIT

The Requires

 

The Development Requires