endel / slim-lightncandy-view
基于 Handlebars/Mustache 模板引擎,通过 lightncandy 构建的 Slim 框架视图助手。
dev-master
2017-05-07 15:49 UTC
Requires
- php: >=5.3.0
- pimple/pimple: ~3.0
- zordius/lightncandy: ^1.0
Requires (Dev)
- phpunit/phpunit: 4.6.0
- slim/slim: ^3.0.0
This package is not auto-updated.
Last update: 2024-09-28 18:10:30 UTC
README
这是一个基于 Lightncandy 模板组件构建的 Slim 框架视图助手,它是一个快速的 PHP 实现 handlebars 和 mustache。
您可以使用此组件在 Slim 框架应用程序中创建和渲染模板。
需要 Slim 3.x.x
安装
通过 Composer
$ composer require endel/slim-lightncandy-view
用法
// Create Slim app $app = new \Slim\App(); // Register Lightncandy View helper $app->register(new \Slim\Views\Lightncandy('path/to/templates', [ 'helpers' => array(...) 'block_helpers' => array(...) ])); // Define named route $app->get('/hello/{name}', function ($request, $response, $args) { $this['view']->render('profile', [ 'name' => $args['name'] ]); })->setName('profile'); // Run app $app->run();
示例
请查看 示例 目录以获取用法示例。
测试
phpunit
贡献
请参阅 CONTRIBUTING 获取详细信息。
鸣谢
许可
MIT 许可证 (MIT)。请参阅 许可文件 获取更多信息。