infw/pug 问题修复 & 功能扩展

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

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

infw/pug

Composer 安装命令:

composer require infw/pug

包简介

Pug template engine for InFw and Zend Expressive

README 文档

README

Scrutinizer Code Quality Code Coverage Build Status Maintainability

Zend Expressive template renderer based on PHP Pug template engine

Installation

Install with composer

For Zend expressive 3

composer require infw/pug

For Zend expressive 2

composer require infw/pug:0.0.2

Enable config provider

<?php
// config/config.php

use Zend\ConfigAggregator\ArrayProvider;
use Zend\ConfigAggregator\ConfigAggregator;
use Zend\ConfigAggregator\PhpFileProvider;

// To enable or disable caching, set the `ConfigAggregator::ENABLE_CACHE` boolean in
// `config/autoload/local.php`.
$cacheConfig = [
    'config_cache_path' => 'data/cache/config-cache.php',
];

$aggregator = new ConfigAggregator([
    \InFw\Pug\ConfigProvider::class,

    ...

    new PhpFileProvider('config/autoload/{{,*.}global,{,*.}local}.php'),

    // Load development config if it exists
    new PhpFileProvider('config/development.config.php'),
], $cacheConfig['config_cache_path']);

return $aggregator->getMergedConfig();

Enable dependencies

<?php
// config/autoload/templates.global

use Zend\Expressive\Template\TemplateRendererInterface;
use InFw\Pug\PugRendererFactory;

return [
    'dependencies' => [
        'factories' => [
            TemplateRendererInterface::class => PugRendererFactory::class,
        ],
    ],

    'templates' => [
        'extension' => 'pug',
    ],
];

Config options

// config/autoload/templates.global.php
    ...
        'pug' => [
            'pretty' => true,
            'expressionLanguage' => 'js',
            'pugjs' => false,
            'localsJsonFile' => false,
            'cache' => 'data/cache/pug',
            'template_path' => 'templates/',
            'default_params' => [
                // globals go here option will be deprecate on 1.0.0 version
                // '*' => [
                //     param => mixed value
                // ]
                // template default params
                // 'template_path::name' => [
                //     param => mixed value
                // ]
            ],
            'filters' => [
                // filter_name => invokable class
            ],
            'keywords' => [
                // keyword => invokable class
            ],
            'helpers' => [
                // helper_name => invokable class
            ]
        ],
    ...    

See full PHP Pug documentation for more detail.

统计信息

  • 总下载量: 44
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 2
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-02-03

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固