PHP code example of phptransformers / phptransformer

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

    

phptransformers / phptransformer example snippets

 php
// With "phptransfomers/twig" package
$transformer = new PhpTransformers\Twig\TwigTransformer();
echo $transformer->render('Hello, {{ name }}!', array(
	'name' => 'World'
));
//=> Hello, World!
 php
$locals = array('name' => 'World');
$output = $transformer->render('Hello, {{ name }}!', $locals);
 php
$locals = array('name' => 'World');
$output = $transformer->renderFile('hello.twig', $locals);