junker / smarty-trait
Silex Smarty Trait
0.1.0
2016-07-04 10:59 UTC
This package is auto-updated.
Last update: 2024-09-10 22:14:13 UTC
README
Silex 的 Smarty Trait
需求
- silex 1.x, 2.x
- SmartyServiceProvider
##安装 最好的安装 Smarty Trait 的方式是使用 Composer
php composer.phar require junker/smarty-trait
##示例
class Application extends \Silex\Application { use \Junker\Silex\Application\SmartyTrait; }
use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\StreamedResponse; $app->get('/', function() use ($app) { return $app->render('index.tpl', ['name' => 'Junker']); $response = new Response(); $response->setTtl(10); return $app->render('index.tpl', ['name' => 'Junker'], $response); return $app->render('index.tpl', ['name' => 'Junker'], new StreamedResponse()); });
##文档 http://silex.sensiolabs.org/doc/master/usage.html#traits