2017 © Pedro Peláez
 

library pug

Pug template engine for InFw and Zend Expressive

image

infw/pug

Pug template engine for InFw and Zend Expressive

  • Wednesday, March 28, 2018
  • by kpicaza
  • Repository
  • 1 Watchers
  • 0 Stars
  • 36 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 6 Versions
  • 0 % Grown

The README.md

Expressive Phug Template Renderer

Scrutinizer Code Quality Code Coverage Build Status Maintainability, (*1)

Zend Expressive template renderer based on PHP Pug template engine, (*2)

Installation

Install with composer, (*3)

For Zend expressive 3, (*4)

composer require infw/pug

For Zend expressive 2, (*5)

composer require infw/pug:0.0.2

Enable config provider, (*6)

<?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, (*7)

<?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., (*8)

The Versions

03/02 2018

0.0.2

0.0.2.0

Pug template engine for InFw and Zend Expressive

  Sources   Download

MIT

The Requires

 

The Development Requires

zend framework expressive infw php-pug

03/02 2018

0.0.1

0.0.1.0

Pug template engine for InFw and Zend Expressive

  Sources   Download

MIT

The Requires