leafs/veins

Veins templating engine for the Leaf PHP framework

v2.0.4 2023-04-28 07:43 UTC

This package is auto-updated.

Last update: 2024-03-28 09:57:24 UTC


README

Veins is a simple, lightweight, and fast templating engine for PHP. It is designed to be easy to use and easy to extend.

Installation

You can install Veins using the Leaf CLI:

leaf install veins

Or with composer:

composer require leafs/veins

Usage

<?php

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

use Leaf\Veins;

$veins = new Veins();
$veins->configure([
    'templateDir' => __DIR__ . '/views/',
    'cacheDir' => __DIR__ . '/cache/',
]);
$veins->render('hello', ['name' => 'John']);
<!-- views/hello.php -->
<h1>Hello, {$name}!</h1>

Configuration

You can configure Veins by passing an array to the configure method:

$veins->configure([
    'checksum' => [],
    'charset' => 'UTF-8',
    'debug' => false,
    'templateDir' => 'views/',
    'cacheDir' => 'cache/',
    'baseUrl' => '',
    'phpEnabled' => false,
    'autoEscape' => true,
    'sandbox' => true,
    'removeComments' => false,
    'customTags' => [],
]);

Find the full documentation at leafphp.dev/modules/views/veins.