PHP code example of patinthehat / templated-text

1. Go to this page and download the library: Download patinthehat/templated-text library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

patinthehat / templated-text example snippets




ermafrost\TemplatedText\TemplatedText;

$tt = new TemplatedText;

$tt ->variable('one', 'OONNEE')
    ->variable('hw', 'Hello World')
    ->filter('test', function($v) { return '->>'.$v.'<<-'; })
    ->template('This is a test template, one is {{one|aquote}} and {{hw}}! then, {{hw | quote | test}}!! and {{one | quote}} ');

echo $tt->process() . PHP_EOL . PHP_EOL;