eghojansu / stuck-template
此包已被弃用且不再维护。未建议替代包。
PHP 模板
dev-master
2021-10-11 09:18 UTC
Requires
- php: ^8.0.0
Requires (Dev)
- phpunit/phpunit: ^9.5
This package is auto-updated.
Last update: 2022-02-22 01:57:30 UTC
README
PHP 模板引擎。
安装
- 使用 composer
composer req eghojansu/php-template:dev-master
使用
<?php require __DIR__ . '/vendor/autoload.php'; $directories = './templates/'; // template directories, could be an array of directory or directories delimited by "," OR ";" OR "|" $extensions = 'php'; // template extension $templateManager = new Stuck\Template\Manager($directories); echo $templateManager->render('view'); // will render './templates/view.php'
功能
- PHP 8.0
- 无依赖
- 全局变量
- 自定义助手函数
- 可链式调用
- 模板继承
- 通过利用
htmlspecialchars
转义数据。
免责声明
这只是一个简单的 PHP 模板引擎。代码覆盖率已达到 100%,但不能保证完全无bug。