Simple Templating Engine using PHP


Here’s a simple, light-weight, innovative and fast templating engine for PHP, client-side JavaScript and Node.js. It is fully working and extensible, and like other templating engines out there, it is multipurpose and elegant. This Repository does a minimum amount of caching and parsing to build dynamic templates that can be used in both PHP and JavaScript.

The complete source code and necessary project files of the proposed Templating Engine can be downloaded from the link below. A project report is not available for this one, so you can refer the description provided here and use it to create a synopsis of the project.

Download Simple Templating Engine using PHP with Source Code


Download Simple Templating Engine using PHP with Source Code and Screenshots


PHP Templating Engine – Project Abstract:

This templating engine is very versatile, but you may encounter a few performance issues sometimes as it is built with minimum features. So, PHP, itself being a templating language, was used for the development. The result is a very fast, simple, and multipurpose templating engine.

The repository does minimum parsing and caching to develop dynamic templates and tries to contain the much needed functionality inside the common language subset. It can cache templates both in PHP and JavaScript dynamically. File system caching has 3 modes:

  1. NONE: uses only in-memory caching,
  2. NOUPDATE: caches the templates only once, and
  3. AUTOUPDATE: re-creates the cached template if original template has changed.


  • simple
  • light-weight
  • innovative
  • multipurpose
  • elegant
  • easily extensible and configurable


This templating engine uses just 2 classes — one for PHP and one for JavaScript: Contemplate.php and Contemplate.js respectively. No other dependencies!

Sample Source Code – Test.php:

Similar Projects:
Online Shopping Cart
Statistics Reporter
Daily Horroscope

You can use test.php to test the basic functionality of the template. This file is available in the download link or you can copy-paste the source code presented above.

More PHP projects and mini projects can be found here.


Please enter your comment!
Please enter your name here