mirror of
https://github.com/fenom-template/fenom.git
synced 2023-08-10 21:13:07 +03:00
fbf4f46f1f
Migrate to php8 |
||
---|---|---|
.github | ||
docs | ||
sandbox | ||
src | ||
tests | ||
.coveralls.yml | ||
.gitignore | ||
.travis.yml | ||
authors.md | ||
CHANGELOG.md | ||
composer.json | ||
composer.lock | ||
license.md | ||
phpunit.xml.dist | ||
README.md |
Fenom - Template Engine for PHP
Fenóm - lightweight and fast template engine for PHP.
- Subject: Template engine
- Syntax: Smarty-like
- Documentation: English, Russian
- PHP version: 8.0+
- State:
- Version:
- Packagist: fenom/fenom
- Composer:
composer require fenom/fenom
- Discussion: Fenom Forum
- Versioning: semver2
- Performance: see benchmark
Quick Start
Install
If you use composer in your project then you can to install Fenom as package.
Setup
There is two-way to create Fenom instance:
- Long way: use operator
new
- Shot way: use static factory-method
Long way. Create you own template provider or default provider Fenom\Provider
(that is provider read there).
Using provider instance create Fenom instance:
$fenom = new Fenom(new Fenom\Provider($template_dir));
After that, set compile directory:
$fenom->setCompileDir($template_cache_dir);
This directory will be used for storing compiled templates, therefore it should be writable for Fenom. Now Fenom is ready to work and now you can to configure it:
$fenom->setOptions($options);
Short way. Creating an object via factory method with arguments from long way.
$fenom = Fenom::factory($template_dir, $template_cache_dir, $options);
Now Fenom is ready to work.