ameotoko / feathericon-bundle
v1.0.1
2022-05-06 14:53 UTC
Requires
- php: ^7.4 || ^8.0
- pixelrobin/php-feather: ^1.0
README
Simple Symfony/Twig wrapper for FeatherIcons and pixelrobin/php-feather library.
安装
- 使用 Composer 安装
composer require ameotoko/feathericon-bundle
- 启用组件
// config/bundles.php return [ // ... Ameotoko\FeatherIcon\AmeotokoFeatherIconBundle::class => ['all' => true], ];
用法
该组件为您提供了新的 Twig 模板函数,底层使用 getIcon()
从 php-feather。
在您的 .html.twig
模板中的此代码
<button type="submit">{{ feathericon('send', {stroke: '#ddd', 'stroke-width': 4}) }} Submit</button>
将产生与以下代码相同的结果
<?php $icons = new \Feather\Icons(); ?> <button type="submit"><?= $icons->get('send', ['stroke' => '#ddd', 'stroke-width' => 4], false) ?> Submit</button>