fenom/README.md

63 lines
2.1 KiB
Markdown
Raw Permalink Normal View History

Fenom - Template Engine for PHP
===============================
2013-01-28 12:04:07 +04:00
2016-04-13 11:34:38 +03:00
**Fenóm** - lightweight and fast template engine for PHP.
2013-02-07 20:04:00 +04:00
2016-04-13 11:34:38 +03:00
* **Subject:** Template engine
* **Syntax:** Smarty-like
2016-05-08 00:38:17 +03:00
* **Documentation:** **[English](./docs/en/readme.md)**, **[Russian](./docs/ru/readme.md)**
2023-02-07 01:49:54 +03:00
* **PHP version:** 8.0+
2023-02-24 00:09:39 +03:00
* **State:** [![PHP Composer](https://github.com/fenom-template/fenom/actions/workflows/php.yml/badge.svg?branch=master)](https://github.com/fenom-template/fenom/actions/workflows/php.yml) [![Coverage Status](https://coveralls.io/repos/fenom-template/fenom/badge.svg?branch=master)](https://coveralls.io/r/fenom-template/fenom?branch=master)
2016-04-13 11:34:38 +03:00
* **Version:** [![Latest Stable Version](https://poser.pugx.org/fenom/fenom/v/stable.png)](https://packagist.org/packages/fenom/fenom)
* **Packagist:** [fenom/fenom](https://packagist.org/packages/fenom/fenom) [![Total Downloads](https://poser.pugx.org/fenom/fenom/downloads.png)](https://packagist.org/packages/fenom/fenom)
* **Composer:** `composer require fenom/fenom`
* **Discussion:** [Fenom Forum](https://groups.google.com/forum/#!forum/php-ion)
* **Versioning:** [semver2](http://semver.org/)
* **Performance:** see [benchmark](./docs/en/benchmark.md)
2014-08-06 23:36:04 +04:00
2016-04-13 11:34:38 +03:00
***
2016-04-13 11:34:38 +03:00
## Quick Start
2014-05-08 12:56:37 +04:00
2016-04-13 11:34:38 +03:00
### Install
2014-05-14 17:33:48 +04:00
2016-04-14 12:58:16 +03:00
If you use composer in your project then you can to install Fenom as package.
2016-05-06 23:04:08 +03:00
### Setup
2016-04-14 12:58:16 +03:00
2023-02-07 01:49:54 +03:00
There is two-way to create Fenom instance:
2016-04-14 12:58:16 +03:00
* 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:
```php
$fenom = new Fenom(new Fenom\Provider($template_dir));
```
After that, set compile directory:
```php
$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:
```php
$fenom->setOptions($options);
```
2016-05-06 23:04:08 +03:00
**Short way.** Creating an object via factory method with arguments from long way.
2016-04-14 12:58:16 +03:00
```php
$fenom = Fenom::factory($template_dir, $template_cache_dir, $options);
```
Now Fenom is ready to work.
2014-05-14 17:33:48 +04:00
2016-05-06 23:04:08 +03:00
### Usage
### Example