PHPackages                             tyam/bamboo - 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. tyam/bamboo

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

tyam/bamboo
===========

PHP template engine, which has variables-pulling facility.

0.2.0(6y ago)189MITPHPPHP &gt;=5.6

Since Jan 24Pushed 6y ago1 watchersCompare

[ Source](https://github.com/tyam/bamboo)[ Packagist](https://packagist.org/packages/tyam/bamboo)[ Docs](https://github.com/tyam/bamboo)[ RSS](/packages/tyam-bamboo/feed)WikiDiscussions master Synced 2d ago

READMEChangelogDependencies (2)Versions (4)Used By (0)

bamboo
======

[](#bamboo)

Bamboo is a PHP template engine, which has the following characteristics:

- native PHP as template language; no compile. familiar and well-defined syntax
- using global functions as helpers/escapers; no redundant `$e->h()`/`E::h()`. just `eh()`
- facility to *PULL* template variables from the program side

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

[](#installation)

```
composer install tyam\bamboo
```

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

[](#basic-usage)

PHP side

```
// You must specify template base directory to the bamboo engine.
$basedirs = ['/your/template/dirs', '/come/here'];
$engine = new \tyam\bamboo\Engine($basedirs);

// Render the template with template variables. You get an output string.
$variables = ['title' => $this->getTitle(), 'content' => $this->getContent()];
$output = $engine->render('mytpl', $variables);
$respond->setOutput($output);
```

template side: /your/template/dirs/mytpl.php

```

```

- A filename extension for template file is 'php'
- Path separator for the base directory is fixed as slash. bamboo engine converts to host specific one.

Including another template
--------------------------

[](#including-another-template)

subject template: /your/template/dirs/mytpl.php

```
content comes here...
