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

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

chh/meta-template
=================

Templating solution with adapters to many engines.

v1.0.0beta1(13y ago)42.8k1[4 issues](https://github.com/CHH/meta-template/issues)1MITPHPPHP &gt;=5.3.6CI failing

Since Jan 20Pushed 12y ago1 watchersCompare

[ Source](https://github.com/CHH/meta-template)[ Packagist](https://packagist.org/packages/chh/meta-template)[ Docs](https://github.com/CHH/meta-template)[ RSS](/packages/chh-meta-template/feed)WikiDiscussions master Synced 3d ago

READMEChangelogDependencies (9)Versions (3)Used By (1)

MetaTemplate
============

[](#metatemplate)

*A library which provides adapters to different PHP templating engines*

Install
-------

[](#install)

MetaTemplate follows the PSR-0 standard for class loading, so its classes can be loaded with every compliant autoloader, such as `Zend_Loader` or the Symfony Classloader.

Installation is easy, just register the `MetaTemplate` namespace with your autoloader and point it to the directory where you copied the contents of the `lib` directory to.

Basic Usage
-----------

[](#basic-usage)

Most of the time you will be consuming engines via the `Template` class. It provides some methods, which take a filename and return a template instance.

MetaTemplate ships with these adapters/engines by default:

- `PHPTemplate`, mapped to `.php` and `.phtml`
- `PhpSass`, mapped to `.sass` and `.scss`
- `MarkdownTemplate` (requires [php-markdown](http://github.com/michelf/php-markdown) to be loaded), mapped to `.md` and `.markdown`
- `LessTemplate` (requires Less to be installed via node), mapped to `.less` (Requires Symfony\_Process 2)
- `MustacheTemplate` (requires [phly\_mustache](http://github.com/weierophinney/phly_mustache)), mapped to `.mustache`

The `MetaTemplate\Template` class has a static `create` method, which creates template instances from a given path.

For example:

```
