PHP code example of megumi / wp-twig

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

    

megumi / wp-twig example snippets




$twig = new Twig_Environment( new Twig_Loader_String() );
$twig->addExtension( new Megumi\WP\Twig_Extension() );

$content = $twig->render( '{{ name | esc_html }}', array( 'name' => '<strong>' ) );
$this->assertSame( '&lt;strong&gt;', $content );