PHP is a powerful server-side scripting language for creating dynamic and interactive websites. It is the widely-used, free, and efficient alternative to competitors such as Microsoft's ASP.
PHP template engines are used widely to separate the code & the layout. In this article, you will read about the 10 interesting PHP Template Engines.
One of the most popular PHP templating engine which prefers to call itself a "template/presentation framework" . A library that allows the creation of HTML templates that are imported and used in PHP scripts to ease the process of web page design. Smarty is well equip PHP Template Engines for both the designer & programmers with powerful tools at the presentation layer. Smarty is mainly focus is on quick and painless development and deployment of your application, while maintaining high-performance, scalability, security and future growth.
- Configuration Files
- Easy to Use and Maintain
- Variable Modifiers
- Template Functions
- Plugins and Add-ons support
- high Performance.
PEAR is a framework and distribution system for reusable PHP components. Currently PEAR supports the all list of licenses: 1. PHP License 2. Apache License 3. LGPL 4.BSD style 5.MIT License . 4 PEAR packages are available for templating :
Savant is a lightweight object-oriented template system for PHP. it uses PHP itself as its template language so you don't need to learn a new markup system.
The Savant source code is easy to read, understand, and extend, because it is exceptionally well-commented. The object-oriented plugin, filter, error, and compiler classes for Savant are easy to use, understand, and extend.
Dwoo template engine is a great alternative to Smarty, it is (nearly) fully compatible with its templates and plugins, but it is written from scratch and aimed at going one step further with a cleaner codebase.
- Template Inheritance, a fresh look at complex template structures, now built without includes
- Smarty syntax compatibility with several additions and shortcuts to speed up template writing .
- Flexible plugin creation
- Scope aware engine, allowing for shorter templates
- Unicode / UTF-8 support for string manipulation functions.
- Generally faster than Smarty with variable speed improvements depending on the features used.
- E_STRICT compliant code
- Ready to use with several frameworks using provided adapters
Vemplator is open source PHP template engine, written in PHP , that strives to be light-weight yet featured, and does quite well in only 200 lines of code. The template syntax is concise, and the code is written to be extensible. Though it may be somewhat strict (doesn’t allow function calls from the template, among other things) it’s very usable.
- Ability to make function calls from within templates
- Template variables
- Conditionals: if/else
- Conditionals: switch statements (case values can be string constants or other variables)
- Dot-notation for class member variables (customer.name)
- Numerically indexed arrays: record
- Associative arrays: customer['name']
- Array elements indexed by other template variables: customer[ key ]
- Foreach looping
- Caching of parsed templates
XTemplate is a open source template engine for PHP that allows you to store your HTML code separately to your PHP code. It has many useful features yet code is short and highly optimized. Xtemplate is available for both PHP 5 and PHP 4.
Blitz templates is a fast template engine written in C and compiled as a PHP module.It started as a php_templates replacement, but developed into much more. It is based on extensible template controllers (PHP) and weakly-active templates (HTML)
FryPHP is fast and easy to learn templating engine/system for PHP5. FryPHP is written in object oriented manner using test driven development (TDD) and it allows local variables for each template, you also can set global variables. FryPHP makes use of method overloading and provides FryHelpers which save a lot of time on routineous HTML generation, such as selects generation for date selection. FryPHP is a open source project released under the GNU/LGPL License.
FXL Template an easy to use template engine covering all the basic features of a template system. It supports simple text/array assignments, blocks and nested blocks. Well- used regular expressions and the simple markup are responsible for quick rendering. To install FXL Template you need PHP 5.1 or later and Windows, Linux, Unix, FreeBSD or Mac OS .
Vivvo Template Engine is originally developed for Vivvo CMS. Vivvo is a light-weight and easy to use, yet powerful and scalable Template Engine. The template engine that can do recursions, object calls, arrays, but still remain within a single class in less than 1000 lines of code! .
VTE language is XML-based and it consists of tags and attributes. VTE has only 14 instructions for loading and manipulating data, assigning custom JS and CSS, building control structures.
- Easy to learn
- Presentation layer separated from PHP
- Powerful data manipulation
- Orientated towards web components
Template Lite uses most of the same basic syntax as Smarty template engine, making it relatively easy to port template files from Smarty and for previous users of Smarty to quickly learn how to use it. Template Lite variable syntax, specifically variables in double quotes and concatentation, is designed to imitate PHP's, making variable usage intuitive for beginners who are used to programming in PHP.