Tiler provides a flexible, fast and secure template engine.
- Tiler is object oriented pattern
- Tiler don't force yourself to learn something new
- Tiler is simple like PHP, is powerful like PHP
Tiler allows you to create child themes, parent themes and ancestor themes.
Tiler will check if the required template is present in the child theme otherwise it will look for it in the parent theme and continue along the chain of themes.
If Tiler it doesn't find the template in the parent theme it will throw an exception.
Use Composer
$ composer require guglielmopepe/tiler
Tiler use a Chain of Responsability design pattern.
This is a template in /child/theme directory:
// path file: /child/theme/template.php
<p><strong><?php echo $data['foo']; ?></strong></p>
This is a template in /parent/theme directory:
// path file: /parent/theme/template.php
<p><b><?php echo $data['foo']; ?></b></p>
This is a template in /ancestor/theme directory:
// path file: /ancestor/theme/template.php
<p><?php echo $data['foo']; ?></p>
Tiler will check if the required template is present in the child theme otherwise it will look for it in the parent theme and continue along the chain of themes.
$data = new \Classes\Data(['foo'=>'bar']);
$handler = new \Tiler\Classes\Handler('/directory/of/child/theme');
$handler->connect(new \Tiler\Classes\Handler('/directory/of/parent/theme'));
$handler->connect(new \Tiler\Classes\Handler('/directory/of/ancestor/theme'));
$command = new \Tiler\Classes\Command($data, $handler);
echo $command->render('/template.php');
If you have a request, please create a GitHub issue.
If you discover a security vulnerability, please send an email to Guglielmo Pepe at info@guglielmopepe.com. All security vulnerabilities will be promptly addressed.
The Data class allows you to pass data as if it were an array, but by extending the class you can also pass a Service Locator: you have an HMVC.
Tiler has three separate classes for maximum flexibility:
- You can use the Data class with a service Locator or as a Simple array;
- You can use the Handler class in combination with a Strategy to load the template on a per-user basis;
- You can use the Command class in conjunction with a Proxy to delay loading data into the template.
If you want to say thank you and/or support the active development of tiler
:
- Add a GitHub Star to the project.
- Share the project on social media.
- Write a review or tutorial on Medium, Dev.to or personal blog.
If you need information please send an email to info@guglielmopepe.com.
See the list of open issues:
Please see Changelog file for more information on what has changed recently.
Distributed under the MIT License. Please see License File for more information.