2017 © Pedro Peláez
 

library template-bridge

Template bridge between your legacy and other template engines

image

srcoder/template-bridge

Template bridge between your legacy and other template engines

  • Wednesday, December 13, 2017
  • by JeroenBoersma
  • Repository
  • 1 Watchers
  • 1 Stars
  • 25 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 10 Versions
  • 0 % Grown

The README.md

Template bridge

Template bridge between your legacy php code and newer template engines., (*1)

Dependencies

Requires minimum of PHP 7.0. Also uses srcoder/normalize-strings for string manipulation., (*2)

Engines

  • Plain
  • Twig
  • Compatible

Basic usage

Use the manager to define your templates., (*3)

use \Srcoder\TemplateBridge\Manager;
use \Srcoder\TemplateBridge\Engine\Twig;
use \Srcoder\TemplateBridge\Engine\Plain;

// Initialize template bridge
$templateBridge = new Manager;
// or static
$templateBridge = Manager::instance();

// Add a engine
$templateBridge->add(
        'twig',         // Name
        new Twig(),     // Template engine
        300             // Prio, higher is more important
);

$templateBridge->add(
        'plain',        // Name
        new Plain(),    // Template engine
        600             // Prio, higher is more important
);


// Adding a file
$templateManager->addFile('file');
// Will search for file.twig and file

// Render template
echo $templateBridge->render();

Data

When rendering something you can add data to it., (*4)

use \Srcoder\TemplateBridge\Data;

echo $templateBridge->render(new Data(['key' => 'value']))

Fun part

Twig engine

When a Twig file is found it will work exactly as you expect., (*5)

Plain engine

Plain files will replace {{$variable}} from the Data object Plain engine can also be used for javascript and html, (*6)

Compatible engine

The Versions

13/12 2017

dev-master

9999999-dev

Template bridge between your legacy and other template engines

  Sources   Download

MIT

The Requires

 

The Development Requires

13/12 2017

1.0.2

1.0.2.0

Template bridge between your legacy and other template engines

  Sources   Download

MIT

The Requires

 

The Development Requires

13/12 2017

1.0.1

1.0.1.0

Template bridge between your legacy and other template engines

  Sources   Download

MIT

The Requires

 

The Development Requires

13/12 2017

1.0.0

1.0.0.0

Template bridge between your legacy and other template engines

  Sources   Download

MIT

The Requires

 

The Development Requires

04/09 2017

0.10.3

0.10.3.0

Template bridge between your legacy and other template engines

  Sources   Download

MIT

The Requires

 

30/08 2017

0.10.2

0.10.2.0

Template bridge between your legacy and other template engines

  Sources   Download

MIT

The Requires

 

30/08 2017

0.10.1

0.10.1.0

Template bridge between your legacy and other template engines

  Sources   Download

MIT

The Requires

 

30/08 2017

0.10.0

0.10.0.0

Template bridge between your legacy and other template engines

  Sources   Download

MIT

The Requires

 

30/08 2017

0.9.0

0.9.0.0

Template bridge between your legacy and other template engines

  Sources   Download

MIT

The Requires

 

23/08 2017

0.8.1

0.8.1.0

Template bridge between your legacy and other template engines

  Sources   Download

MIT

The Requires