cedricziel/twig-loader-flysystem
Composer 安装命令:
composer require cedricziel/twig-loader-flysystem
包简介
Flysystem loader for the twig templating language
README 文档
README
Flysystem loader for the Twig templating engine.
Installation
The library is installable through composer:
composer require cedricziel/twig-loader-flysystem
Usage
Adapted from the official Twig documentation
$localAdapter = new League\Flysystem\Adapter\Local(__DIR__); $filesystem = League\Flysystem\Filesystem($localAdapter); $loader = new CedricZiel\TwigLoaderFlysystem\FlysystemLoader($filesystem); $twig = new \Twig_Environment($loader); $template = $twig->loadTemplate('index.html.twig'); $content = $template->render(array('the' => 'variables', 'go' => 'here'));
The loader also supports using a subdirectory on the associated flysystem as permanent prefix:
$localAdapter = new League\Flysystem\Adapter\Local(__DIR__); $filesystem = League\Flysystem\Filesystem($localAdapter); $loader = new CedricZiel\TwigLoaderFlysystem\FlysystemLoader($filesystem, 'templates'); $twig = new \Twig_Environment($loader); // this will load 'templates/index.html.twig' from the current flysystem filesystem $template = $twig->loadTemplate('index.html.twig'); $content = $template->render(array('the' => 'variables', 'go' => 'here'));
License
MIT
统计信息
- 总下载量: 145
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 6
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2016-07-06