Zend Framework 2 でテンプレートエンジン"Twig"を使ってみる

1. Install ZF-Commons/ZfcTwig

composer.json

"require": {
    "zf-commons/zfc-twig": "dev-master"
}

2. Setup

application.config.php

return array(
    // This should be an array of module namespaces used in the application.
    'modules' => array(
        'Application',
        'ZfcTwig', // Add ZfcTwig to your config/application.config.php file under the modules key
    ),

module.config.php

'template_map' => array(
    'layout/layout'           => __DIR__ . '/../view/layout/layout.twig',
    'application/index/index' => __DIR__ . '/../view/application/index/index.twig',
    'error/404'               => __DIR__ . '/../view/error/404.twig',
    'error/index'             => __DIR__ . '/../view/error/index.twig',
),


ZF-Commons/ZfcTwig · GitHub

 


Set Up Zend Framework 2 with Behat and Twig - Never Stop Building