innmind/templating

3.2.0 2023-09-16 16:58 UTC

This package is auto-updated.

Last update: 2024-09-16 19:10:46 UTC


README

Build Status codecov Type Coverage

用于封装PHP模板引擎的库(目前仅支持twig)。

安装

composer require innmind/templating

用法

use Innmind\Templating\Factory;
use Innmind\Templating\Name;
use Innmind\Url\Path;

$render = Factory::build(
    Path::of('templates/dir'),
    Path::of('/tmp/cache'), // optional
    Map::of(), // optional, variables accesible everywhere in templates
);
$rendered = $render(new Name('template.html.twig')); // Instance of Innmind\Filesystem\File\Content