PHP code example of eclipxe / engineworks-templates
1. Go to this page and download the library: Download eclipxe/engineworks-templates library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
eclipxe / engineworks-templates example snippets
use EngineWorks\Templates\Callables;
use EngineWorks\Templates\Plugins;
use EngineWorks\Templates\Resolver;
use EngineWorks\Templates\Templates;
// create callables
$callables = new Callables();
$callables->attach(
new Plugins\HtmlEscape(),
new Plugins\FormatNumber(),
new Plugins\Transliterate(),
);
// create resolver
$resolver = new Resolver(__DIR__ . '/templates');
// create templates
$templates = new Templates($callables, $resolver);
// fetch the content of a template (templates/user-details.php)
/* @var $user array */
$content = $templates->fetch('user-details', ['user' => $user]);
// do whatever with the response, I will just echo it
echo $content;