torann/snazzy-twig 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

torann/snazzy-twig

Composer 安装命令:

composer require torann/snazzy-twig

包简介

Render user templates using the power of Twig

README 文档

README

Latest Stable Version Total Downloads

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

GitHub 信息

  • Stars: 0
  • Watchers: 2
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: BSD-2-Clause
  • 更新时间: 2016-02-24

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固