Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/operfildoluiz/leoch
๐ยท Leoch is a lightweight PHP server-side template rendering engine
https://github.com/operfildoluiz/leoch
package php rendering template-engine template-rendering
Last synced: 27 days ago
JSON representation
๐ยท Leoch is a lightweight PHP server-side template rendering engine
- Host: GitHub
- URL: https://github.com/operfildoluiz/leoch
- Owner: operfildoluiz
- License: mit
- Created: 2017-11-13T16:59:28.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2018-04-30T19:06:03.000Z (over 6 years ago)
- Last Synced: 2024-04-21T07:02:04.177Z (8 months ago)
- Topics: package, php, rendering, template-engine, template-rendering
- Language: PHP
- Homepage: https://lhcgoncalves.github.io/leoch/
- Size: 15.6 KB
- Stars: 7
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[![Sele_o_001.png](https://s17.postimg.cc/kjbvqrcm7/Sele_o_001.png)](https://postimg.org/image/ugmwjtk7v/)
Leoch is a simple PHP server-side template rendering engine.
## Demo
See `demo/index.php` for server-side reference and `demo/templates/index.leoch.php` for Leoch syntax reference.
## Basic Syntax
Variables
{{$var}}
Conditional Sentences
@if[...]
@elseif[...]
@else
@endif
Iterators
@foreach($array in $var)
I'm a $var
@endforeach
Loops
@while[$i < 10]
$i++
@endwhile
Inside code blocks, there's no need to declare the variable under brackets.
## Rendering
use Leoch\App\Processor\TemplateProcessor;
$template = new Template('demo');
$template->setSrc('example')
->fill([
'somevar' => 'Some Var',
'level' => 'basic',
'somenumber' => 2,
'somearray' => array('Red', 'Blue'),
'somearray2' => array('Vermelho', 'Azul'),
])
->render();