artisanpack-ui/icons 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

artisanpack-ui/icons

最新稳定版本:2.1.0

Composer 安装命令:

composer require artisanpack-ui/icons

包简介

An extensibility layer for Blade Icons that enables flexible registration of custom SVG icon sets via config or events.

README 文档

README

An extensibility layer for custom icon sets that integrates seamlessly with blade-ui-kit/blade-icons and livewire-ui-components. This package provides a simple, flexible way to register and use custom SVG icon sets in your Laravel applications without the overhead of hardcoded icon libraries.

Features

  • Zero Hardcoded Icons: No memory-heavy icon arrays - bring your own icons
  • Seamless Integration: Built on blade-ui-kit/blade-icons foundation
  • Dual Registration System: Configure via config files or register programmatically via events
  • Third-Party Extensible: Other packages can register icon sets via event hooks
  • Font Awesome Pro Ready: Easy integration with Font Awesome Pro and other premium icon sets
  • Performance Optimized: Minimal memory footprint and fast loading

Installation

Install the package via Composer:

composer require artisanpack-ui/icons

Publish the configuration file:

php artisan vendor:publish --tag=artisanpack-package-config

Quick Start

1. Configure Your Icon Sets

Edit config/artisanpack/icons.php to register your icon sets:

return [
    'sets' => [
        'fa' => [
+            'path' => resource_path('icons/fontawesome-pro'),
+            'prefix' => 'fa',
+        ],
+        'brand' => [
+            'path' => resource_path('icons/custom-brand'),
+            'prefix' => 'brand',
+        ],
    ],
];

2. Organize Your Icons

Place your SVG files in the configured directories:

resources/
├── icons/
│   ├── fontawesome-pro/
│   │   ├── home.svg
│   │   └── user.svg
│   └── custom-brand/
│       ├── logo.svg
│       └── badge.svg

3. Use Icons in Blade Templates

{{-- Using Font Awesome Pro icons with 'fa' prefix --}}
<x-icon-fa-home class="w-6 h-6" />
<x-icon-fa-user class="w-5 h-5 text-blue-500" />

{{-- Using custom brand icons with 'brand' prefix --}}
<x-icon-brand-logo class="w-8 h-8" />
<x-icon-brand-badge class="w-4 h-4" />

Registration Methods

Config-Based Registration

The simplest approach - define icon sets in your config/artisanpack/icons.php:

return [
    'sets' => [
        'hero' => [
            'path'   => resource_path('icons/heroicons'), 
            'prefix' => 'hero'
        ],
+       'tabler' => [
            'path'   => resource_path('icons/tabler'),
            'prefix' => 'tabler'
        ],
    ],
];

Event-Driven Registration

Perfect for packages that want to register their own icon sets:

use ArtisanPackUI\Icons\Registries\IconSetRegistration;

// In a service provider or event listener
addFilter('ap.icons.register-icon-sets', function (IconSetRegistration $registry) {
    $registry->addSet(__DIR__ . '/../../resources/icons', 'mypackage');
    return $registry;
});

Documentation

For comprehensive documentation, visit the docs directory:

Getting Started

Advanced Usage

Requirements

  • PHP 8.2 or higher
  • Laravel 12.0 or higher
  • blade-ui-kit/blade-icons ^1.8

Contributing

As an open source project, this package is open to contributions from anyone. Please read through the contributing guidelines to learn more about how you can contribute to this project.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-05-14

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固