2017 © Pedro Peláez
 

library render

Renders templates with a variety of template engines.

image

icanboogie/render

Renders templates with a variety of template engines.

  • Sunday, March 18, 2018
  • by olvlvl
  • Repository
  • 1 Watchers
  • 0 Stars
  • 1,743 Installations
  • PHP
  • 4 Dependents
  • 0 Suggesters
  • 0 Forks
  • 1 Open issues
  • 14 Versions
  • 0 % Grown

The README.md

Render

Release Code Coverage Downloads, (*1)

An API to render templates with a variety of template engines., (*2)

Installation

composer require icanboogie/render

Render engines

Templates may be rendered with a variety of template engines., (*3)

The following example demonstrates how to create an engine provider with the builtin engine for PHP templates., (*4)

<?php

/* @var ICanBoogie\Render\PHPEngine $engine */
/* @var string $template_pathname */
/* @var mixed $content */
/* @var array<string, mixed> $variables */

$rendered = $engine->render($template_pathname, $content, $variables);

Note: Currently, the package only provides an engine to render PHP templates, the available engine can be extended with third parties packages such as render-engine-markdown or render-engine-patron., (*5)

Render engine providers

Render engines are obtained through engine providers. The following providers are builtin:, (*6)

The following examples demonstrates how to obtain an engine for a .php extension from an immutable provider., (*7)

<?php

use ICanBoogie\Render\EngineProvider\Immutable;
use ICanBoogie\Render\PHPEngine;

$engines = new Immutable([ '.php' => new PHPEngine() ]);
echo $engines->engine_for_extension('.php')::class; // ICanBoogie\Render\PHPEngine

All engine providers are traversable, this feature can be used to collect the supported extensions:, (*8)

<?php

/* @var EngineProvider $engines */

$extensions = array_keys(iterator_to_array($engines));

echo implode(', ', $extensions); // .php

The pathname of the template being rendered

Engines should use the Engine::VAR_TEMPLATE_PATHNAME variable to define the pathname of the template being rendered, so that it is easy to track which template is being rendered and from which location., (*9)

Template resolver

A template resolver tries to match a template name with an actual template file. A set of paths can be defined for the resolver to search in., (*10)

Renderer

A Renderer instance is used to render a template with a subject and options. An engine collection and a template resolver are used to find suitable templates for the rendering., (*11)


Continuous Integration

The project is continuously tested by GitHub actions., (*12)

Tests Static Analysis Code Style, (*13)

Code of Conduct

This project adheres to a Contributor Code of Conduct. By participating in this project and its community, you're expected to uphold this code., (*14)

Contributing

See CONTRIBUTING for details., (*15)

The Versions

18/03 2018

0.7.x-dev

0.7.9999999.9999999-dev https://icanboogie.org/

Renders templates with a variety of template engines.

  Sources   Download

BSD-3-Clause

The Requires

 

render decorate

18/03 2018

0.6.x-dev

0.6.9999999.9999999-dev https://icanboogie.org/

Renders templates with a variety of template engines.

  Sources   Download

BSD-3-Clause

The Requires

 

render decorate

18/03 2018

dev-master

9999999-dev https://icanboogie.org/

Renders templates with a variety of template engines.

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

render decorate

18/03 2018

v0.6.0

0.6.0.0 https://icanboogie.org/

Renders templates with a variety of template engines.

  Sources   Download

BSD-3-Clause

The Requires

 

render decorate

06/11 2016

v0.5.1

0.5.1.0 http://icanboogie.org/

Renders templates with a variety of template engines.

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

render decorate

27/12 2015

v0.5.0

0.5.0.0 http://icanboogie.org/

Renders templates with a variety of template engines.

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

render decorate

15/03 2015

v0.4.2

0.4.2.0 http://icanboogie.org/

Renders templates with a variety of template engines.

  Sources   Download

BSD-3-Clause

The Requires

 

render decorate

14/03 2015

v0.4.1

0.4.1.0 http://icanboogie.org/

Renders templates with a variety of template engines.

  Sources   Download

BSD-3-Clause

The Requires

 

render decorate

08/03 2015

v0.4.0

0.4.0.0 http://icanboogie.org/

Renders templates with a variety of template engines.

  Sources   Download

BSD-3-Clause

The Requires

 

render decorate

26/02 2015

v0.3.1

0.3.1.0 http://icanboogie.org/

An API to render and decorate objects.

  Sources   Download

BSD-3-Clause

The Requires

 

render decorate

06/02 2015

v0.3.0

0.3.0.0 http://icanboogie.org/

An API to render and decorate objects.

  Sources   Download

BSD-3-Clause

The Requires

 

render decorate

02/02 2015

v0.2.0

0.2.0.0 http://icanboogie.org/

An API to render and decorate objects.

  Sources   Download

BSD-3-Clause

The Requires

 

render decorate

01/02 2015

v0.1.0

0.1.0.0 http://icanboogie.org/

An API to render and decorate objects.

  Sources   Download

BSD-3-Clause

The Requires

 

render decorate

07/11 2014

v0.1.0-beta.1

0.1.0.0-beta1 http://icanboogie.org/

An API to render and decorate objects.

  Sources   Download

BSD-3-Clause

The Requires

  • php >=5.4.0

 

render decorate