torann/snazzy-twig
Composer 安装命令:
composer require torann/snazzy-twig
包简介
Render user templates using the power of Twig
README 文档
README
Laravel implantation of Skosh's Twig templating engine for use in a multi-tenant environment.
Installation
Composer
From the command line run:
$ composer require torann/snazzy-twig
The Service Provider
You will need to extend the built in service provider so that you can add your custom widgets and get the website instance. To do this create a service provider named TwigServiceProvider in the \app\Providers directory and extend the Snazzy Twig provider like below:
<?php namespace App\Providers; use Torann\SnazzyTwig\TwigServiceProvider as ServiceProvider; class TwigServiceProvider extends ServiceProvider { /** * Twig view widgets. * * @var array */ protected $widgets = [ // ]; /** * Get the current website. * * @return \Torann\SnazzyTwig\Contracts\WebsiteInterface */ protected function getWebsite() { return $this->app['website']; } }
Note: the
getWebsite()method is needed to get the website model to use for generating the views
Once this is done you need to register the new service provider with the application.
Laravel
Open up config/app.php and find the providers key.
'providers' => [ \App\Providers\TwigServiceProvider::class, ]
Lumen
For Lumen register the service provider in bootstrap/app.php.
$app->register(\App\Providers\TwigServiceProvider::class);
统计信息
- 总下载量: 51
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: BSD-2-Clause
- 更新时间: 2016-02-24