1. Go to this page and download the library: Download phpolar/php-templating 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/ */
phpolar / php-templating example snippets
$page = new Page();
$safeContext = new HtmlSafeContext($page);
$templateEng->render("path/to/template.php", $safeContext);
// or...
echo $templateEng->apply("path/to/template", $safeContext /* optional */);
// Page.php
class Page
{
public string $title;
public string $backgroundColor = "#fff";
public string $font = "Arial";
public function __construct(string $title)
{
$this->title = $title;
}
}
bash
composer
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.