devcoder-xyz/php-template-engine

This package is abandoned and no longer maintained. The author suggests using the devcoder-xyz/php-renderer package instead.

a simple php template engine

1.0.1 2022-03-16 15:11 UTC

This package is auto-updated.

Last update: 2023-08-05 20:47:11 UTC


README

A simple PHP template engine

Easy to use:

$template = new Template('var/www/html/project/template', []);
echo $template->render('home-page.php');

With parameters:

$template = new Template('var/www/html/project/template', ['lang' => 'fr']);
echo $template->render('home-page.php', ['title' => 'Home Page']);
<!doctype html>
<html lang="<?php echo $template->get('lang'); ?>">
<head>
  <meta charset="utf-8">
  <title><?php echo $title; ?></title>
  <link rel="stylesheet" href="style.css">
  <script src="script.js"></script>
</head>
<body>
  ...
  <!-- Le reste du contenu -->
  ...
</body>
</html>