PHPackages                             openlss/lib-tpl - 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. openlss/lib-tpl

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

openlss/lib-tpl
===============

Wrapper library for managing PHPTAL environment. Also supports HTML Tidy formatting.

0.0.13(13y ago)01501LGPL-3.0+PHPPHP &gt;=5.3.2

Since Mar 23Pushed 13y ago1 watchersCompare

[ Source](https://github.com/nullivex/lib-tpl)[ Packagist](https://packagist.org/packages/openlss/lib-tpl)[ Docs](http://openlss.org)[ RSS](/packages/openlss-lib-tpl/feed)WikiDiscussions master Synced 3w ago

READMEChangelogDependencies (6)Versions (15)Used By (1)

openlss/lib-tpl
===============

[](#openlsslib-tpl)

Wrapper library for managing PHPTAL environment. Also supports HTML Tidy formatting.

Usage
-----

[](#usage)

```
use \LSS\Config;
use \LSS\Tpl;

//init templating system
$theme = (Config::get('theme','name') ? Config::get('theme','name') : 'default');
Tpl::_get()->setPath(ROOT_GROUP.'/theme/'.$theme);
Tpl::_get()->setUri('/theme/'.$theme.'/');
Tpl::_get()->set(array(
	 'lss_version'		=>	LSS_VERSION
	,'version'			=>	VERSION
	,'site_name'		=>	Config::get('site_name')
	,'site_title'		=>	Config::get('site_name')
	,'uri'				=>	Config::get('url','uri')
	,'url'				=>	Config::get('url','url')
	,'theme_path'		=>	Tpl::_get()->uri
	,'copyright'		=>	'© '.date('Y').' '.Config::get('site_name')
));
unset($theme);

$params = array();

//parse template and return
$params['html'] = Tpl::_get()->output('client_file_manage',$params,false);

//parse template and output
Tpl::_get()->output('client_file_list',$params);
```

Reference
---------

[](#reference)

### (object) Tpl::\_get()

[](#object-tpl_get)

Returns the singleton (creates it if it doesnt exist)

### (object) Tpl::setPath($value)

[](#object-tplsetpathvalue)

Sets the path to the template files

### (object) Tpl::setUri($value)

[](#object-tplseturivalue)

Sets the URI that should be used when parsing templates

### (string) Tpl::addCss($file,$media='screen')

[](#string-tpladdcssfilemediascreen)

Adds a CSS file entry that gets output to the HEAD section of the body

### (bool) Tpl::resetCss()

[](#bool-tplresetcss)

Clears the CSS buffer

### (string) Tpl::addJs($file)

[](#string-tpladdjsfile)

Adds a Javascript file load that will be output to the HEAD section of the body

### (bool) Tpl::resetJs()

[](#bool-tplresetjs)

Clears the JS buffer

### (bool) Tpl::set($name,$value=null,$overwrite=true)

[](#bool-tplsetnamevaluenulloverwritetrue)

Sets a constant that can be used globally in the templates

- $name The name of the constant
- $value The constant value
- $overwrite When set to FALSE will not overwrite existing constant Returns FALSE if unable to write constant

### (bool) Tpl::get($name)

[](#bool-tplgetname)

Get a constant by name If $name is NULL returns entire constant tree Returns NULL if no constant exists

### (string) Tpl::add($html)

[](#string-tpladdhtml)

Add raw data to the template body

### (object) Tpl::reset()

[](#object-tplreset)

Resets the body buffer

### (object) Tpl::setStub($name,$value=true)

[](#object-tplsetstubnamevaluetrue)

Enables stubs that are loaded conditionally

### (object) Tpl::addDebug($value)

[](#object-tpladddebugvalue)

Adds debug output to but printed with the template (allows debug data to be formatted more readible)

### (string) Tpl::debug()

[](#string-tpldebug)

Returns buffered debug data ready for templating

### (string) Tpl::stats()

[](#string-tplstats)

Collects various stats from script execution The return value is ready for templating

### (mixed) Tpl::output($tpl,$params=array(),$echo=true)

[](#mixed-tploutputtplparamsarrayechotrue)

Output Function

- This is the main output handler that calls into PHPTAL
- It will render the specified template file and add the passed tags to the environment
- It also sets up the global environment for page parsing
- NOTE: there should only be one call to this per page unless in extreme circumstances
- ARGUMENTS
- file the template file to be parsed
- tags array of variables to be added to env
- echo when true the tpl system will output directly to the browser and exit

###  Health Score

27

—

LowBetter than 47% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 73% 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 ~3 days

Total

13

Last Release

4812d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/83c8e9d55e3ebafb0621a441a51af8f551f61a274fde5400459a29cc320b7b75?d=identicon)[nullivex](/maintainers/nullivex)

![](https://www.gravatar.com/avatar/afffa5c56642e74ba5b880c4b78e115c1b8d00c74ceae5644ac359d10058a911?d=identicon)[spudz76](/maintainers/spudz76)

---

Top Contributors

[![nullivex](https://avatars.githubusercontent.com/u/2321375?v=4)](https://github.com/nullivex "nullivex (27 commits)")[![Spudz76](https://avatars.githubusercontent.com/u/2391234?v=4)](https://github.com/Spudz76 "Spudz76 (10 commits)")

---

Tags

templatingphptalTAL

### Embed Badge

![Health badge](/badges/openlss-lib-tpl/health.svg)

```
[![Health](https://phpackages.com/badges/openlss-lib-tpl/health.svg)](https://phpackages.com/packages/openlss-lib-tpl)
```

###  Alternatives

[twig/twig

Twig, the flexible, fast, and secure template language for PHP

8.4k457.8M6.8k](/packages/twig-twig)[mustache/mustache

A Mustache implementation in PHP.

3.3k46.6M312](/packages/mustache-mustache)[smarty/smarty

Smarty - the compiling PHP template engine

2.4k40.9M448](/packages/smarty-smarty)[eftec/bladeone

The standalone version Blade Template Engine from Laravel in a single php file

8259.3M103](/packages/eftec-bladeone)[laminas/laminas-view

Fast and type safe HTML templating library with a flexible plugin system supporting multistep template composition

7527.7M261](/packages/laminas-laminas-view)[namesco/ztal

ZTal makes integrating the PHP templating system PHPTAL into Zend Framework easy.

2119.9k](/packages/namesco-ztal)

PHPackages © 2026

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