laasti/views
Composer 安装命令:
composer require laasti/views
包简介
A HTTP Message compatible template engine abstraction.
README 文档
README
A HTTP Message compatible template engine abstraction. Provides a TemplateStream that can be attached to HTTP Message's Response.
Only support PHP and Mustache (bobthecow/mustache.php) templates for the moment, PRs are welcome to add more engines.
Installation
composer require laasti/views
Usage
$renderer = new \Laasti\Views\TemplateRenderer; //You can add many engines to support multiple template types $renderer->addEngine(new \Laasti\Views\Engines\PlainPhp([/*View directory*/])); //You can set global data to pass on to all template $renderer->setData('sitename', 'Hello world!'); //Or you can pass data only to one template $template = new \Laasti\Views\Template("template-name.php", new \Laasti\Views\Data\ArrayData(['title' => 'Hello world!'])); //attackStream will create a TemplateStream and attach it to the response's body $response = $renderer->attachStream($response, $template); //The title and sitename will be available as $title and $sitename in the template
Contributing
- Fork it!
- Create your feature branch:
git checkout -b my-new-feature - Commit your changes:
git commit -am 'Add some feature' - Push to the branch:
git push origin my-new-feature - Submit a pull request :D
History
See Github's releases or tags
Credits
Author: Sonia Marquette (@nebulousGirl)
License
Released under the MIT License. See LICENSE.txt file.
统计信息
- 总下载量: 180
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 5
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2016-02-21