2017 © Pedro Peláez
 

library templateengine

Component that abstracts template engines and offers easy to use PHP template engine

image

activecollab/templateengine

Component that abstracts template engines and offers easy to use PHP template engine

  • Sunday, May 22, 2016
  • by ilijastuden
  • Repository
  • 2 Watchers
  • 0 Stars
  • 5,102 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 9 % Grown

The README.md

Template Engine

Build Status, (*1)

This package offers a single interface for interaction with multiple template engines. It ships with simple PHP template engine built in:, (*2)

$template_engine = new PhpTemplateEngine('/path/to/templates/dir');

// Set attributes that will be passed to all templates. Method chaining is supported.
$template_engine->setAttributes([
    'app_name' => 'My Awesome App',
    'app_version' => '1.0.0',
])->addAttribute('app_env', 'staging');

// Render template to output buffer
$template_engine->display('/mail/hello.php', ['first_name' => 'John'])

// Render template and return output as a string
$output = $template_engine->fetch('/mail/hello.php', ['first_name' => 'John'])

Template Sandboxing

Templates are sandboxed, and can be placed only in templates directory that is specified when engine is constructed. If you try to use a template that is not in this directory, template engine will throw a \RuntimeException:, (*3)

$template_engine->fetch('/example/../../../../etc/passwd'); // Will throw an exception

The Versions

22/05 2016

dev-master

9999999-dev

Component that abstracts template engines and offers easy to use PHP template engine

  Sources   Download

MIT

The Requires

  • php >=5.6.0

 

The Development Requires

template view

22/05 2016

1.0.1

1.0.1.0

Component that abstracts template engines and offers easy to use PHP template engine

  Sources   Download

MIT

The Requires

  • php >=5.6.0

 

The Development Requires

template view

22/05 2016

1.0.0

1.0.0.0

Component that abstracts template engines and offers easy to use PHP template engine

  Sources   Download

MIT

The Requires

  • php >=5.6.0

 

The Development Requires

template view