ameotoko/feathericon-bundle

安装: 119

依赖: 0

建议者: 0

安全: 0

星标: 0

关注者: 2

分支: 0

公开问题: 0

类型:symfony-bundle

v1.0.1 2022-05-06 14:53 UTC

This package is auto-updated.

Last update: 2024-09-06 19:43:56 UTC


README

Simple Symfony/Twig wrapper for FeatherIcons and pixelrobin/php-feather library.

安装

  1. 使用 Composer 安装
composer require ameotoko/feathericon-bundle
  1. 启用组件
// 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>

了解有关使用 php-feather 的更多信息