PHP code example of krzksz / phcompile

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

    

krzksz / phcompile example snippets


$phCompile = new \PhCompile\PhCompile(); // Create PhCompile object
$template = new \PhCompile\Template\Template($phCompile); // Create template
$template->setScope(new Scope(array('foo'=>'bar'))); // Set scope data.

$template->loadHtml('template.html'); // Load from file
$template->setHtml('<span ng-bind="foo"></span>'); // Or just from string
echo $template->compile(); // "<span ng-bind="foo">bar</span>"