定制 xbirdfr/ux-icons-alias-bundle 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

xbirdfr/ux-icons-alias-bundle

最新稳定版本:1.0.2

Composer 安装命令:

composer require xbirdfr/ux-icons-alias-bundle

包简介

A Bundle that provides alias for Symfony UX Icons

README 文档

README

⚠️ NOTE: This repository is no longer maintained, as Symfony UX now provides a more robust solution for handling icon aliases.
For more details, please refer to the alias system in the Symfony UX documentation.

This bundle provides an alias system for Symfony UX Icons.

It adds a Twig function on top of the IconRendererInterface introduced in version 2.19 of symfony/ux-icons.

Installation

Make sure Composer is installed globally, as explained in the installation chapter of the Composer documentation.

Applications Using Symfony Flex

Open a terminal, navigate to your project directory, and run the following command:

composer require xbirdfr/ux-icons-alias-bundle

Applications Not Using Symfony Flex

Step 1: Download the Bundle

Open a terminal, navigate to your project directory, and run the following command to download the latest stable version of this bundle:

composer require xbirdfr/ux-icons-alias-bundle

Step 2: Enable the Bundle

Then, enable the bundle by adding it to the list of registered bundles in your project's config/bundles.php file:

// config/bundles.php

return [
    // ...
    Xbird\UxIconsAliasBundle\UxIconsAliasBundle::class => ['all' => true],
];

Usage

Step 1: Create the Configuration File

Create the ux_icons_alias.yaml file in the config/packages directory:

# config/packages/ux_icons_alias.yaml
ux_icons_alias:
  alias:

Step 2: Create an Alias

Create your first alias by adding a "key: icon-name" pair to the alias array:

# config/packages/ux_icons_alias.yaml
ux_icons_alias:
  alias:
    home: material-symbols:home

Don't forget to clear the cache, unless your alias will not show up

php bin/console cache:clear

Step 3: Use Your New Alias

In a Twig template, use the ux_icon_alias function to display your aliased icon:

{{ ux_icon_alias('alias', { attributes }) }}
{# In a Twig template #}
<div>
    {{ ux_icon_alias('home') }}
</div>
<div>
    {{ ux_icon_alias('home', {class: 'w-4 h-4'}) }}
</div>

One More Thing

This bundle is built on top of the symfony/ux-icons bundle.

When called, the bundle checks if the alias exists in the configuration. If it does, the corresponding value is passed to ux-icons. If the alias does not exist, the alias name itself is passed to ux-icons.

统计信息

  • 总下载量: 10
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 3
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-08-13

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固