spiral / twig-bridge
Spiral Framework: Twig Adapter
Installs: 20 983
Dependents: 5
Suggesters: 1
Security: 0
Stars: 0
Watchers: 6
Forks: 2
Open Issues: 2
Requires
- php: ^8.1
- spiral/core: ^3.0
- spiral/framework: ^3.0
- spiral/views: ^3.0
- twig/twig: ^3.3.3
Requires (Dev)
- phpunit/phpunit: ^9.5.20
- spiral/testing: ^2.0
- vimeo/psalm: ^4.23
README
Documentation | Framework Bundle
Installation
The extension requires spiral/views
package.
composer require spiral/twig-bridge
To enable extension modify your application by adding Spiral\Twig\Bootloader\TwigBootloader
:
class App extends Kernel { /* * List of components and extensions to be automatically registered * within system container on application start. */ protected const LOAD = [ // ... Spiral\Twig\Bootloader\TwigBootloader::class, ]; }
Configuration
You can enable any custom twig extension by requesting Spiral\Twig\TwigEngine
in your bootloaders:
class TwigExtensionBootloader extends Bootloader { public function boot(TwigEngine $engine) { $engine->addExtension(new Extension()); } }
Lazy Configuration
To configure TwigEngine on demand use functionality provided by TwigBootloader
:
class TwigExtensionBootloader extends Bootloader { public function boot(TwigBootloader $twig) { $twig->addExtension('container.binding'); } }
Note Following methods are available
setOption
,addExtension
,addProcessor
.
License:
MIT License (MIT). Please see LICENSE
for more information. Maintained by Spiral Scout.