PHPackages                             tandrezone/ztemp - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Templating &amp; Views](/categories/templating)
4. /
5. tandrezone/ztemp

ActiveLibrary[Templating &amp; Views](/categories/templating)

tandrezone/ztemp
================

A lightweight, secure PHP template engine supporting {{ $variable }}, @include(), and @foreach()/@endforeach directives.

v2.0.0(1mo ago)0141MITPHP ^8.1

Since Apr 28Compare

[ Source](https://github.com/tandrezone/ztemp)[ Packagist](https://packagist.org/packages/tandrezone/ztemp)[ RSS](/packages/tandrezone-ztemp/feed)WikiDiscussions Synced 3w ago

READMEChangelog (5)Dependencies (2)Versions (13)Used By (1)

ztemp
=====

[](#ztemp)

A lightweight, **secure** PHP template engine for processing plain HTML files.

Features
--------

[](#features)

DirectiveSyntaxDescriptionVariable output`{{ $name }}`Inserts a parameter value (HTML-escaped)Include`@include(path/to/partial.html)`Embeds another templateConditional`@if($var) … @else … @endif`Renders content conditionallyLoop`@foreach($items) … @endforeach`Iterates over an array parameterLoop (alias)`@foreach($items as $item) … @endforeach`Iterates with a custom item aliasLoop (key =&gt; value)`@foreach($items as $k => $v) … @endforeach`Iterates with key and value aliases### Security built-in

[](#security-built-in)

- All variable output is **HTML-escaped** (`htmlspecialchars`) — no raw HTML injection.
- `@include` is **path-traversal safe** — files outside the configured base directory are rejected.
- Circular `@include` chains are detected and stopped (max depth: 10).
- Null bytes in template paths are rejected.

---

Requirements
------------

[](#requirements)

- PHP **8.1** or higher

---

Installation
------------

[](#installation)

```
composer require tandrezone/ztemp
```

---

Quick Start
-----------

[](#quick-start)

```
