Skip to content

Tiler provides a flexible, fast and secure template engine.

License

Notifications You must be signed in to change notification settings

GuglielmoPepe/tiler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Tiler

Tiler provides a flexible, fast and secure template engine.

Table of Contents

Benefits

  • Tiler is object oriented pattern
  • Tiler don't force yourself to learn something new
  • Tiler is simple like PHP, is powerful like PHP

Features

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.

Installation

Use Composer

$ composer require guglielmopepe/tiler

Usage

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');

Support

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.

FAQ

Why use Data class with ArrayAccess interface?

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.

Why does Tiler have three separate classes?

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.

Contributing

If you want to say thank you and/or support the active development of tiler:

  1. Add a GitHub Star to the project.
  2. Share the project on social media.
  3. Write a review or tutorial on Medium, Dev.to or personal blog.

Contacts

If you need information please send an email to info@guglielmopepe.com.

Roadmap

See the list of open issues:

Change log

Please see Changelog file for more information on what has changed recently.

License

Distributed under the MIT License. Please see License File for more information.

About

Tiler provides a flexible, fast and secure template engine.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages