PHP code example of ppeco / tplpp

1. Go to this page and download the library: Download ppeco/tplpp 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/ */

    

ppeco / tplpp example snippets


use ppeco\tplpp\Template;

// From string
$template = new Template("Hello, {{\$variable.'!'}}");

//..or from file
$template = Template::fromFile("./example.tpl");

echo $template->addValue("variable", "World"); // Output: Hello, World!

//Alternative
echo $template->addValues([
    "variable" => "World"
]);