https://github.com/sensorario/engine
A template engine
https://github.com/sensorario/engine
Last synced: about 2 months ago
JSON representation
A template engine
- Host: GitHub
- URL: https://github.com/sensorario/engine
- Owner: sensorario
- Created: 2022-09-17T00:23:49.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2023-06-06T03:02:15.000Z (about 3 years ago)
- Last Synced: 2025-01-19T19:45:41.477Z (over 1 year ago)
- Language: PHP
- Size: 103 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
Awesome Lists containing this project
README
# Engine
This is a php engine. Made just to play. Learn. And becouse I simply love code. Please do not use this in production. It works. It is tested. But I am using it just to make some videos about open source or just for training.
[TOC]
## Components
- [Engine](/src/Engine/) - the engine
- [Form](/src/Engine/Ui/Form) - forms
- [Grid](/src/Engine/Ui/Grid) - grid
- [View](/src/Engine/Ui/View) - search items
## Installation
```
composer install sensorario/engine
```
### Usage
```
require __DIR__ . '/vendor/autoload.php';
use Sensorario\Engine\EngineFactory;
$engine = (new EngineFactory)->getEngine();
$engine->render('template', $model);
```
### Foreach
```
- {{item.id}}
{% foreach items as item %}
{% endforeach %}
```
### If statement
```
{% if foo.bar is 42 %}
{% endif %}
```
## UI
This engine provides few UI items. A Grid, paginated. A Form.
### View
```
{{View:{
"model": {
"title":"Ricerca"
}
}}}View
```
### Form
```
{{Form:{
"form": {
"method": "POST",
"action": "cippalippa"
},
"fields": [
{ "name" : "name" },
{ "name" : "surname" },
{ "name" : "ciaone" },
{ "name" : "dob" }
]
}}}Form
```
### Grid
```
{{Grid:{
"source":{
"repository":"Sensorario.Engine.ExampleRepo",
"resource":"",
"itemPerPage":"2"
},
"model":{
"title":"Griglia",
"headers": [
{ "type" : "text" , "field" : "name", "name" : "NOME" },
{ "type" : "text" , "field" : "surname", "name" : "COGNOME" }
],
"rowIdentifier":"id"
}
}}}Grid
```