PHP code example of kokspflanze / zfc-twig

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

    

kokspflanze / zfc-twig example snippets


// in module configuration or autoload override
return [
    'zfctwig' => [
        'extensions' => [
            // an extension that uses no key
            'My\Custom\Extension',

            // an extension with a key so that you can remove it from another module
            'my_custom_extension' => 'My\Custom\Extension'
        ]
    ]
];

// in module configuration or autoload override
return [
    'zfctwig' => [
        'loader_chain' => [
            'MyTwigFilesystemLoader'
        ]
    ]
];

// in some module
public function getServiceConfiguration()
{
    return [
        'factories' => [
            'MyTwigFilesystemLoader' => function($sm) {
                return new \Twig\Loader\FilesystemLoader('my/custom/twig/path');
            }
        ]
    ];
}