PHP code example of mediagone / twig-powerpack

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

    

mediagone / twig-powerpack example snippets


namespace App\UI\Partials;

final class Menu
{
    private string $name;
    private array $items;
    
    public function __construct(string $name, array $items)
    {
        $this->name = $name;
        $this->items = array_map(static fn($item) => new MenuItem($item), $items);
    }
}
twig
{% expect nullable array of nullable 'App\\UI\\ViewModels\\Foo' as ARRAY %}