Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/scottchiefbaker/sluz
Lightweight PHP templating system with similar syntax to Smarty
https://github.com/scottchiefbaker/sluz
Last synced: 9 days ago
JSON representation
Lightweight PHP templating system with similar syntax to Smarty
- Host: GitHub
- URL: https://github.com/scottchiefbaker/sluz
- Owner: scottchiefbaker
- Created: 2022-04-17T04:09:17.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-08-04T02:30:06.000Z (3 months ago)
- Last Synced: 2024-10-17T23:00:01.281Z (19 days ago)
- Language: PHP
- Size: 232 KB
- Stars: 2
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Sluz PHP templating system
Sluz is a minimalistic PHP templating engine with an emphasis on
syntax similar to [Smarty](https://www.smarty.net/). This allows
you to separate your logic (`.php`) and your presentation (`.stpl`)
files.The goal of Sluz is to be a **small**, single PHP source file, that
emulates simple Smarty-like syntax.## Getting started
File: `script.php`
```php
include('/path/to/sluz/sluz.class.php');
$s = new sluz();$s->assign("name", "Jason");
$s->assign("version", "0.3");print $s->fetch("tpls/script.stpl");
```File: `tpls/script.stpl`
```Hello {$name}
Welcome to Sluz version: {$version}
```## Requirements
Sluz has no external library requirements. **Only** the `sluz.class.php` is
needed for the library to function.## Testing
Sluz has an extensive test suite that is used to verify compatibility
across PHP versions. As of this writing Sluz passes all unit tests on
PHP versions: 8.0, 8.1, 8.2, 8.3, and 8.4.To run the tests issue this command at the CLI:
```
php unit_tests/tests.php
```**Note:** Care was take to ensure that no `E_NOTICE` warnings are emitted
to insure Sluz is `error_reporting(E_ALL)` compliant.## Documentation
There is extensive documentation in the `docs/` with real world examples of the syntax.
## Naming
Sluz is pronounced "sloos". The name comes from the "S" in Smarty
and "luz" which is Spanish for light. Sluz is a lite, Smarty-like
templating system.