mickaelandrieu/twig-skill

安装: 25

依赖: 1

建议: 0

安全性: 0

星标: 0

关注者: 2

分支: 0

开放问题: 0

类型:jarvis-skill

v0.2 2015-12-24 14:43 UTC

This package is auto-updated.

Last update: 2024-09-05 17:50:31 UTC


README

安装

您需要使用Composer安装它,然后确保在Jarvis应用程序启动时此配置可用

<?php

require_once __DIR__.'/vendor/autoload.php';

$jarvis = new Jarvis\Jarvis([
    'container_provider' => [
        'Jarvis\Skill\Twig\ContainerProvider',
    ],
    'twig' => [
        'templates_paths' => '/path/to/templates',
    ],
]);

注意,templates_paths是一个必需的参数。此技能会更改某些选项的默认值

  • debug:如果没有提供,此值将取Jarvis debug参数的值。
  • auto_reload:在此技能中默认设置为true
  • strict_variables:此选项默认也设置为true

您可以在Twig文档中查看完整的选项列表。

<?php

require_once('./../vendor/autoload.php');
require_once('./../config.php');

use Jarvis\Jarvis;
/* ... */

$jarvis->router->addRoute('get', '/', function ($jarvis) {
    return $jarvis->twig->render('index.twig', ['world' => 'World']);
});

$response = $jarvis->analyze();

$response->send();