Veins is a simple, lightweight, and fast templating engine for PHP. It is designed to be easy to use and easy to extend.
You can install Veins using the Leaf CLI:
leaf install veins
Or with composer:
composer require leafs/veins
<?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>
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.