PHPackages                             romeoz/rock-template - 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. romeoz/rock-template

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

romeoz/rock-template
====================

Flexible template engine for PHP with MODx-like syntax

0.14.1(10y ago)39172MITPHPPHP &gt;=5.4.0

Since Jul 28Pushed 10y ago2 watchersCompare

[ Source](https://github.com/romeOz/rock-template)[ Packagist](https://packagist.org/packages/romeoz/rock-template)[ RSS](/packages/romeoz-rock-template/feed)WikiDiscussions master Synced today

READMEChangelog (10)Dependencies (10)Versions (22)Used By (2)

Template engine for PHP
=======================

[](#template-engine-for-php)

[![Latest Stable Version](https://camo.githubusercontent.com/f621e841659fb26620952fb50c1e23729120b4d048ad1bcbb9ee2212c5dddbff/68747470733a2f2f706f7365722e707567782e6f72672f726f6d654f7a2f726f636b2d74656d706c6174652f762f737461626c652e737667)](https://packagist.org/packages/romeOz/rock-template)[![Total Downloads](https://camo.githubusercontent.com/f9da2c6fa4f7b083aa859172a740092c001feac01a8f07f473c029de29f1b806/68747470733a2f2f706f7365722e707567782e6f72672f726f6d654f7a2f726f636b2d74656d706c6174652f646f776e6c6f6164732e737667)](https://packagist.org/packages/romeOz/rock-template)[![Build Status](https://camo.githubusercontent.com/d4a13760382300e227341ade282d381f16881f0fac3787942ce4fabdb454bb19/68747470733a2f2f7472617669732d63692e6f72672f726f6d654f7a2f726f636b2d74656d706c6174652e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/romeOz/rock-template)[![HHVM Status](https://camo.githubusercontent.com/420b8bbe3aeda18de91f209fe41b3996d328d3e768260d323adf7f70de1cb623/687474703a2f2f6868766d2e683463632e64652f62616467652f726f6d656f7a2f726f636b2d74656d706c6174652e737667)](http://hhvm.h4cc.de/package/romeoz/rock-template)[![Coverage Status](https://camo.githubusercontent.com/0de099b1cb2c8d1341d1c15ce5ac8b918c0a40886a6789884d74486259bd3731/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f726f6d654f7a2f726f636b2d74656d706c6174652f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/r/romeOz/rock-template?branch=master)[![License](https://camo.githubusercontent.com/e398f506607c8efecc0c2912d7196cccd0a11926cfdaba3841e1c30771013703/68747470733a2f2f706f7365722e707567782e6f72672f726f6d654f7a2f726f636b2d74656d706c6174652f6c6963656e73652e737667)](https://packagist.org/packages/romeOz/rock-template)

Features
--------

[](#features)

- Supports native PHP engine and declarative MODx-like syntax (placeholders, chunk, snippet,...)
- Supports multi-engines
- Multi-scopes (`$root` and `$parent`)
- The variety of filters (arithmetic/bitwise operations, conditions, string, date, and url)
- Custom auto-escaping
- Support adding/customization filters and snippets
- There is a possibility of adding custom extensions
- Widgets
- Caching all entities template engine
- Standalone module/component for [Rock Framework](https://github.com/romeOz/rock)

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

[](#installation)

From the Command Line:

`composer require romeoz/rock-template`

In your composer.json:

```
{
    "require": {
        "romeoz/rock-template": "*"
    }
}
```

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

[](#quick-start)

\###PHP engine

```
use rock\template\Template;

$template = new Template;

echo $template->render('/path/to/layout.php', ['foo' => 'world!!!']);
```

Contents layout.php:

```

Hello
```

\###Rock engine

```
use rock\template\Template;

echo (new Template)->render('/path/to/layout', ['foo' => 'world!!!']);
```

Contents layout.html:

```
Hello [[+foo]]
```

Documentation
-------------

[](#documentation)

- [Guide on Rock engine](https://github.com/romeOz/rock-template/blob/master/docs/rock.md)
- [Guide on PHP engine](https://github.com/romeOz/rock-template/blob/master/docs/php.md)

[Demo](https://github.com/romeOz/docker-rock-template)
------------------------------------------------------

[](#demo)

- [Install Docker](https://docs.docker.com/installation/) or [askubuntu](http://askubuntu.com/a/473720)
- `docker run --name demo -d -p 8080:80 romeoz/docker-rock-template`
- Open demo

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

[](#requirements)

- **PHP 5.4+**
- For caching layouts, chunks, placeholders and others variables required [Rock Cache](https://github.com/romeOz/rock-cache): `composer require romeoz/rock-cache`
- For using a widgets required [Rock Widgets](https://github.com/romeOz/rock-widgets): `composer require romeoz/rock-widgets`
- For validation rules a model required [Rock Validate](https://github.com/romeOz/rock-validate): `composer require romeoz/rock-validate`
- For sanitization rules a model required [Rock Sanitize](https://github.com/romeOz/rock-sanitize): `composer require romeoz/rock-sanitize`
- For using filters to snippets required [Rock Filters](https://github.com/romeOz/rock-filters): `composer require romeoz/rock-filters`
- For editing a image (cropping, watermarks and etc) required [Rock Image](https://github.com/romeOz/rock-image): `composer require romeoz/rock-image`
- For generating CSRF-token (security) required [Rock CSRF](https://github.com/romeOz/rock-csrf): `composer require romeoz/rock-csrf`
- For building a datetime (DateTimeSnippet and filter date) required [Rock DateTime](https://github.com/romeOz/rock-date): `composer require romeoz/rock-date`

> All unbolded dependencies is optional

License
-------

[](#license)

The Rock Template engine is open-sourced software licensed under the [MIT license](http://opensource.org/licenses/MIT).

###  Health Score

29

—

LowBetter than 57% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity17

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity57

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~22 days

Total

21

Last Release

3907d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/23c5d84a59845d751cb69f5469986579b9312c54c898b366fefdc05baaa80a9c?d=identicon)[romeOz](/maintainers/romeOz)

---

Top Contributors

[![romeOz](https://avatars.githubusercontent.com/u/3135712?v=4)](https://github.com/romeOz "romeOz (243 commits)")

---

Tags

templatetemplate engine

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/romeoz-rock-template/health.svg)

```
[![Health](https://phpackages.com/badges/romeoz-rock-template/health.svg)](https://phpackages.com/packages/romeoz-rock-template)
```

###  Alternatives

[talesoft/tale-pug

A clean, lightweight and easy-to-use templating engine for PHP based on Pug, formerly Jade

319.5k3](/packages/talesoft-tale-pug)[leitsch/kirby-blade

Enable Laravel Blade Template Engine for Kirby 4 and Kirby 5

2110.6k](/packages/leitsch-kirby-blade)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
