template-interop/smarty-adapter

template-interop/engine 的 Smarty 适配器

0.0.1 2019-09-16 16:15 UTC

This package is auto-updated.

Last update: 2024-09-17 03:29:03 UTC


README

smarty/smartytemplate-interop/engine 提供适配器。

安装

此软件包可通过 Composer 进行安装和自动加载。

$ composer require template-interop/smarty-adapter

使用方法

<?php

use Interop\Template\Smarty\SmartyEngine;

$smarty = new Smarty;
$smarty->setTemplateDir(__DIR__.'/templates');
$engine = new SmartyEngine($smarty);
echo $engine->render('greeting', ['name' => 'John']);

您还可以将其与 template-interop/middleware 结合使用,以在 HTTP 中间件栈应用程序中使用它。