crodas / simple-view-engine
Simple View engine designed to generate code. Based on Laravel's 4 Blade.
Installs: 4 973
Dependents: 14
Suggesters: 0
Security: 0
Stars: 5
Watchers: 3
Forks: 0
Open Issues: 0
Requires
Suggests
- crodas/asset: To use assets with the view
- dev-master
- v0.1.37
- v0.1.36
- v0.1.35
- v0.1.34
- v0.1.33
- v0.1.32
- v0.1.31
- v0.1.30
- v0.1.29
- v0.1.28
- v0.1.27
- v0.1.26
- v0.1.25
- v0.1.24
- v0.1.23
- v0.1.22
- v0.1.21
- v0.1.20
- v0.1.19
- v0.1.18
- v0.1.17
- v0.1.16
- v0.1.15
- v0.1.13
- v0.1.12
- v0.1.11
- v0.1.10
- v0.1.9
- v0.1.8
- v0.1.7
- v0.1.6
- v0.1.5
- v0.1.4
- v0.1.3
- v0.1.2
- v0.1.1
- v0.1.0
- dev-develop
This package is auto-updated.
Last update: 2024-11-12 19:51:42 UTC
README
This project is a simple template compiler which aims to be compatible with Laravel's Blade view engine.
It is different though as it generates code which doesn't depent at all in this project to run, therefore it can compile templates offline once.
How to use it
The simplest way of using the compiler is by downloading the phar
cli application.
wget https://github.com/crodas/SimpleView/raw/master/view-compiler.phar -O view-compiler chmod +x view-compiler
Now you have the view-compiler
script ready to run. It is very simple to use now:
./view-compiler compile tests/views/
That would generate a single file tests/views/Templates.php
with all our templates compiled.
require "tests/views/Templatas.php"; // By defualt its content will be print Templates::get("if.tpl.php")->render(["name" => "cesar", "age" => 25]); // but it can buffered as well $buffer = Templates::get("if.tpl.php")->render(["name" => "cesar", "age" => 25], true); echo $buffer;
You can optionally give a namespace to the generate template file to avoid class name conflicts
./view-compiler compile tests/views/ -N demo
Syntax
It is compatible with Laravel's Blade view engine.
TODO
- Better error support
- Mode documentation