PHP code example of gluephp / glue-twig

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

    

gluephp / glue-twig example snippets


$app = new Glue\App;

$app->config->override([
    'twig' => [
        'path'    => '/absolute/path/to/templates/folder',
        'config'  => [
            // Additional Twig config, read Twigs 
            // documentation for more info...
        ]
    ],
]);

$app->register(
    new Glue\Twig\ServiceProvider()
);

$twig = $app->make('Twig_Environment');

$twig = $app->twig;