theq86/zf3-twig

Twig integration for Zend Framework 3 MVC Layer

This package's canonical repository appears to be gone and the package has been frozen as a result.

0.2.3 2017-08-04 16:15 UTC

This package is not auto-updated.

Last update: 2020-05-27 10:31:15 UTC


README

Twig integration for Zend Framework 3 MVC Layer

Installation:

composer require theq86/zf3-twig:^0.2

How to use (Quickstart)

  • Add 'TwigModule' to modules.config.php
return [
    'Zend\Router',
    'Zend\Validator',
    'Application',
    'TwigModule',
];
  • Add TwigStrategy to the ViewManager
'view_manager' => [
    [...]
    'strategies' => [
        'TwigStrategy'
    ],
    [...]
],
  • In your Controller action, return an instance of TwigModel
public function twigAction()
{
    return new TwigModel([
        'test' => 'Welt'
    ]);
}
  • In your view directory, add view script with .html.twig Extension