junker/smarty-trait

Silex Smarty Trait

0.1.0 2016-07-04 10:59 UTC

This package is auto-updated.

Last update: 2024-12-10 22:48:23 UTC


README

Smarty Trait for Silex

Requirements

  • silex 1.x, 2.x
  • SmartyServiceProvider

##Installation The best way to install Smarty Trait is to use a Composer:

php composer.phar require junker/smarty-trait

Examples

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());
});

##Documentation http://silex.sensiolabs.org/doc/master/usage.html#traits