PHP code example of dpolac / twig-const

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

    

dpolac / twig-const example snippets



    class Message {
        const TYPE_INFO = "INFO";
        // ...
    }
    $msg = new Message();

$twig->addExtension(new \DPolac\TwigConst\ConstExtension());

$twig->addExtension(new \DPolac\TwigConst\ConstExtension('const'));
$twig->addExtension(new \DPolac\TwigConst\ConstExtension('::'));

{{ msg const TYPE_ERROR }}
{{ msg::TYPE_ERROR }}