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

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

slepic/php-template
===================

Simple PHP abstraction of template rendering.

1.1.0(5y ago)220.4k1BSD-3-ClausePHPPHP &gt;=7.4CI failing

Since Apr 28Pushed 5y ago1 watchersCompare

[ Source](https://github.com/slepic/php-template)[ Packagist](https://packagist.org/packages/slepic/php-template)[ RSS](/packages/slepic-php-template/feed)WikiDiscussions master Synced yesterday

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

[![Build Status](https://camo.githubusercontent.com/013ddbea2b102fa03f072e9d4a37473c276e6386e2f7200982dfd28360058f11/68747470733a2f2f7472617669732d63692e6f72672f736c657069632f7068702d74656d706c6174652e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/slepic/php-template)[![Style Status](https://camo.githubusercontent.com/0646b12d56d5f520a122b69f5b21350e2263120100f34fb16535826bab932e2d/68747470733a2f2f7374796c6563692e696f2f7265706f732f3138333833343738312f736869656c64)](https://styleci.io/repos/183834781)

php-template
============

[](#php-template)

Template rendering abstraction library. Abstract your libraries from specific templating engines.

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

[](#requirements)

PHP 7.4 or 8

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

[](#installation)

Install with composer

`composer require slepic/php-template`

Interfaces
----------

[](#interfaces)

### [`TemplateInterface`](https://github.com/slepic/php-template/blob/master/src/TemplateInterface.php)

[](#templateinterface)

This is the abstraction of any data rendering template.

Classes
-------

[](#classes)

### [`OutputBufferTemplate`](https://github.com/slepic/php-template/blob/master/src/OutputBufferTemplate.php)

[](#outputbuffertemplate)

A simple template implementation, which renders the data using another PHP script (given its filename) and PHP ob\_\* functions.

### [`DefaultDataTemplate`](https://github.com/slepic/php-template/blob/master/src/DefaultDataTemplate.php)

[](#defaultdatatemplate)

Template decorator which allows to feed your templates with default data hidden from the template consumer.

Contribution
------------

[](#contribution)

If you create a library that depends on this one and you use composer, please consider the following:

- If you implement the `TemplateInterface`, please place [`slepic/php-template-implementation`](https://packagist.org/providers/slepic/php-template-implementation) in the provide section of your `composer.json`.
- If you consume the `TemplateInterface`, please place [`slepic/php-template-consumer`](https://packagist.org/providers/slepic/php-template-consumer) in the provide section of your `composer.json`.

Changelog
---------

[](#changelog)

### 1.1.0

[](#110)

- added new class `DefaultDataTemplate`
- `OutputBufferTemplate` now ends the output buffer if the included template throws an exception.
- `OutputBufferTemplate` now uses `include` instead of `require` to execute the template script .

### 1.0.0

[](#100)

- bump PHP to ^7.4 || ^8.0
- TemplateInterface::render() now has string return typehint
- OutputBufferTemplate::render throws InvalidArgumentException if data argument contains keys that cannot be used as local variable names
- use squizlabs/php\_codesniffer instead of friendsofphp/php-cs-fixer for style check
- bump dev deps to latest versions
- use composer docker image for dev
- move composer scripts to makefile

### 0.2.0

[](#020)

- Added array typehint for first argument of `TemplateInterface::render()`.
- Changed travis setup to only run tests in oldest and newest php versions supported by this package (that is 5.6 and 7.3).

###  Health Score

34

—

LowBetter than 75% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity29

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity64

Established project with proven stability

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

Total

5

Last Release

2030d ago

Major Versions

0.2.0 → 1.0.02020-05-10

PHP version history (3 changes)0.1.0PHP ^5.6 || ^7.0

1.0.0PHP ^7.4 || ^8.0

1.1.0PHP &gt;=7.4

### Community

Maintainers

![](https://www.gravatar.com/avatar/5dd1cd12d4fe4974ad1e3609065ac4eb13c29023606c289c08153c432da827cf?d=identicon)[slepic](/maintainers/slepic)

---

Top Contributors

[![slepic](https://avatars.githubusercontent.com/u/8199404?v=4)](https://github.com/slepic "slepic (19 commits)")

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

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

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

###  Alternatives

[limenius/react-bundle

Client and Server-side react rendering in a Symfony Bundle

3851.2M](/packages/limenius-react-bundle)[area17/laravel-auto-head-tags

Laravel Auto Head Tags helps you build the list of head elements for your app

4616.1k](/packages/area17-laravel-auto-head-tags)[jelix/wikirenderer

WikiRenderer is a library to generate HTML or anything else from wiki content.

1712.3k1](/packages/jelix-wikirenderer)[webkinder/sproutset

A Composer package for handling responsive images in Roots Bedrock + Sage + Blade projects.

282.2k](/packages/webkinder-sproutset)

PHPackages © 2026

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