PHP code example of jdecool / twig-constant-accessor-bundle

1. Go to this page and download the library: Download jdecool/twig-constant-accessor-bundle 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/ */

    

jdecool / twig-constant-accessor-bundle example snippets




return [
    // ...
    JDecool\Bundle\TwigConstantAccessorBundle\JDecoolTwigConstantAccessorBundle::class => ['all' => true],
];

use JDecool\Bundle\TwigConstantAccessorBundle\Annotation\AsTwigConstantAccessor;

#[AsTwigConstantAccessor]
class MyClass
{
    // ...
}
yaml
twig_constant_accessor:
    classes:
        - AppBundle\Model\Foo
        - { class: 'AppBundle\Model\Bar' }
        - { class: 'AppBundle\Model\FooBar', alias: 'FooBarAlias' }
        - { class: 'AppBundle\Model\ConstantClass', matches: '/^RULE_/' } # matches accept an regexp compatible with the preg_match function