biurad/biurad-templating

This package is abandoned and no longer maintained. The author suggests using the biurad/templating package instead.

Template Manager syntax is the best syntax renderer for HTML, XML and tag based documents

v0.1.0 2020-05-04 02:02 UTC

This package is auto-updated.

Last update: 2020-10-16 08:19:09 UTC


README

The component is able to work with multiple rendering engines (Twig, Stempler, Latte, Blade, or native PHP templates) and store view files in multiple namespaces or paths.

Template Engines offer structured solution to implement this view engines segregation.

Please note that this documentation is currently work-in-progress. Feel free to contribute.

Installation

The recommended way to install Template Manager is via Composer:

composer require biurad/biurad-templating

It requires PHP version 7.0 and supports PHP up to 7.4. The dev-master version requires PHP 7.1.

How To Use

User Interfaces are template files which include static (HTML) and dynamic parts.

Dynamic parts are the places which Template Engine put information there. To render view in controller or other service simply invoke render method of ViewsInterface. The view name does not need to include extension (default to be used) by can include namespace. Template Engine returns compiled template (ultimate HTML).

eg:

use BiuradPHP\Template\Templating;
use BiuradPHP\Template\Engine\File\FileEngine;
use BiuradPHP\Template\Engine\Native\NativeEngine;

use function getcwd;

// The View and cache paths 
list($view, $cache) = [(array) getcwd(), getcwd() . '/caches'];

$template  = new Templating($view, true, $cache);
$template->addEngine(new NativeEngine); // This finds views with [php, html and phtml] file extesions.
$template->addEngine(new FileEngine); // This finds views with [js, css adn txt] file extesions.

// Now in your views directory, let's say you have a native template with index.html file extension.
echo $template->render('index'); // Voila, you have your rendered contents.

Changelog

Please see CHANGELOG for more information what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Testing

To run the tests you'll have to start the included node based server if any first in a separate terminal window.

With the server running, you can start testing.

vendor/bin/phpunit

Security

If you discover any security related issues, please report using the issue tracker. use our example Issue Report template.

Want to be listed on our projects website

You're free to use this package, but if it makes it to your production environment we highly appreciate you sending us a message on our website, mentioning which of our package(s) you are using.

Post Here: Project Patreons - https://patreons.biurad.com

We publish all received request's on our website;

Credits

Support us

Biurad Lap is a technology agency in Accra, Ghana. You'll find an overview of all our open source projects on our website.

Does your business depend on our contributions? Reach out and support us on to build more project's. We want to build over one hundred project's in two years. Support Us achieve our goal.

Reach out and support us on Patreon. All pledges will be dedicated to allocating workforce on maintenance and new awesome stuff.

Thanks to all who made Donations and Pledges to Us.

License

The BSD-3-Clause . Please see License File for more information.