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

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

crazedsanity/template
=====================

Templating library.

v0.4.8(8y ago)0483[4 issues](https://github.com/crazedsanity/template/issues)2MITPHPPHP &gt;=5.3.0

Since Feb 11Pushed 8y ago1 watchersCompare

[ Source](https://github.com/crazedsanity/template)[ Packagist](https://packagist.org/packages/crazedsanity/template)[ Docs](http://www.crazedsanity.com)[ RSS](/packages/crazedsanity-template/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (1)Versions (27)Used By (2)

Template [![Build Status](https://camo.githubusercontent.com/22f5e397956071e3a673cd98592c604d6970e7046153155197f0076e86271127/68747470733a2f2f7472617669732d63692e6f72672f6372617a656473616e6974792f74656d706c6174652e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/crazedsanity/template)
=======================================================================================================================================================================================================================================================================================================

[](#template-)

Template system, based on cs\_genericPage from cs-content (v1.x).

This is a templating engine, built primarily to allow easy separation between PHP and HTML. Separating PHP from HTML helps keep the code clean and tends to avoid spaghetti code from happening.

Quick Definitions
-----------------

[](#quick-definitions)

*Template*: a file containing template vars.

*Template Var*: a string of text, following standard variable naming conventions, wrapped in curly braces: `{templateVar}`

Sample
------

[](#sample)

This is a simple example. Keep in mind that there's a lot of different ways to accomplish this same end result.

```
$recordSet = array(
			0 => array(
				'primary_id'    => 1,
				'record_name'   => 'The First Record',
				'another_field' => 'field value',
				'is_active'     => 0,
			),
			1 => array(
				'primary_id'    => 3,
				'record_name'   => 'A third record',
				'another_field' => 'something else',
				'is_active'     => 1,
			),
);
$tmpl = new Template(__DIR__ .'/path/to/file.tmpl');
$output = $tmpl->renderRows($recordSet);
```

The associated template file would look something like this:

```
===============
{primary_id}|{record_name}|{another_field}|{is_active}|{invalid_field}
----

```

The output would look like this:

```
===============
1|The First Record|field value|0|
----
===============
3|A third record|something else|1|
----

```

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity58

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 ~38 days

Recently: every ~78 days

Total

25

Last Release

3198d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/2e5c258da2d3360da7bc80c01e0a97ff96a036cef58f8a5434daf469ad7cc186?d=identicon)[crazedsanity](/maintainers/crazedsanity)

---

Top Contributors

[![crazedsanity](https://avatars.githubusercontent.com/u/1490894?v=4)](https://github.com/crazedsanity "crazedsanity (44 commits)")

---

Tags

phptemplatedryoaoo

### Embed Badge

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

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

###  Alternatives

[alhimik1986/php-excel-templator

PHP Spreadsheet extension for generating excel files from template

350336.7k1](/packages/alhimik1986-php-excel-templator)

PHPackages © 2026

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