Download the PHP package php-compatible/templates without Composer
On this page you can find all versions of the php package php-compatible/templates. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download php-compatible/templates
More information about php-compatible/templates
Files in php-compatible/templates
Package templates
Short Description Modern PHP-style templating that works on PHP 5.5+
License MIT
Informations about the package templates
templates
Blazing fast PHP templating with zero dependencies.
A lightweight, high-performance template engine that leverages PHP's native output buffering for maximum speed. No parsing overhead, no compilation step, no caching layer needed - just pure PHP execution at full speed.
Why templates?
- Zero overhead - Uses PHP's native
requireand output buffering. No regex parsing, no AST compilation, no runtime interpretation. - Instant rendering - Templates execute as native PHP code. What you write is what runs.
- No dependencies - A single function. No framework required. No external libraries.
- Legacy compatible - Works on PHP 5.5 through 8.x. Modernize your legacy codebase without breaking compatibility.
- Familiar syntax - It's just PHP. No new template language to learn.
Documentation
Full documentation available at phpcompatible.dev/docs/category/templates
Installation
Quick Start
Create a template file views/hello.php:
Render it:
Examples
Loops
Nested Data
HTML Escaping
The template() function does not automatically escape output. For security, use htmlspecialchars():
API
template($path, $variables)
Renders a PHP template file and returns the output as a string.
| Parameter | Type | Description |
|---|---|---|
$path |
string | Path to the template file |
$variables |
array | Associative array of variables available in the template |
Returns: string - The rendered template output
Requirements
- PHP 5.5 or higher
License
MIT