whatwedo / twig-bootstrap-icons
v1.1.2
2024-03-25 16:15 UTC
Requires
- twbs/bootstrap-icons: ^1.0
- twig/twig: ^2.15.3|^3.4.3
Requires (Dev)
- php: >=8.2
- phpstan/phpstan: ^1.10
- phpunit/phpunit: ^9.5
- symfony/config: ^7.0
- symfony/dependency-injection: ^7.0
- symfony/http-kernel: ^7.0
- whatwedo/php-coding-standard: ^1.0
README
为Bootstrap Icons提供Twig集成。此包受marcw/twig-heroicons的启发。
安装
composer require whatwedo/twig-bootstrap-icons
Twig集成
只需注册扩展
$twig->addExtension(new BootstrapIconsExtensions());
Symfony集成
// bundles.php return [ whatwedo\TwigBootstrapIcons\whatwedoTwigBootstrapIconsBundle::class => ['all' => true], ];
用法
输出SVG
{{ bootstrap_icon('alarm') }}
你可以将一个数组作为第二个参数传递,以向<svg>
标签添加属性
{{ bootstrap_icon('alarm', { class: 'text-gray-500 mr-3 h-6 w-6' alt: 'alarm clock' }) }}