5ichong/yaf-twig

Yaf framework using Twig is template engine

v0.0.3 2023-08-14 06:13 UTC

This package is not auto-updated.

Last update: 2024-04-22 09:45:16 UTC


README

Yaf using Twig is template engine

Installation

To install Validator, simply:

$ composer require 5ichong/yaf-twig

For latest commit version:

$ composer require 5ichong/yaf-twig @dev

Requirements

Validator works with 7.0, 7.1.

Quick Start and Examples

Add to application.ini:

[product]

application.view.ext = html

[devel : product]

application.twig.debug = true

Add to index.php:

require __DIR__ . '/vendor/autoload.php';

Add to Bootstrap.php

use Yaf\Application;
use Yaf\Dispatcher;

public function _initView(Dispatcher $dispatcher)
{
    $conf = Application::app()->getConfig();

    $options = !empty($conf->twig) ? $conf->twig->toArray() : [];

    $twig = new \Aichong\Twig(APP_PATH . "/views/", $options);

    $dispatcher->setView($twig);
}