vigstudio/laravel-tabler-icons
Composer 安装命令:
composer require vigstudio/laravel-tabler-icons
包简介
The Tabler Icons Blade Component with Facade Support
README 文档
README
Installation
You can install the package via composer:
composer require vigstudio/laravel-tabler-icons
Usage
Using Blade Components (Traditional Way)
<x-tabler-icons::arrow-forward-up/> <x-tabler-icons::arrow-merge-alt-left/> <x-tabler-icons::arrow-left-circle/> <x-tabler-icons::2fa/>
Using Helper Function
{{ tabler_icon('arrow-forward-up') }}
{{ tabler_icon('arrow-merge-alt-left') }}
{{ tabler_icon('arrow-left-circle') }}
{{ tabler_icon('2fa') }}
Using Facade & Helpers (New Way)
// Method 1: Facade (Recommended) {!! TablerIcon::home() !!} {!! TablerIcon::user(['class' => 'text-blue-500']) !!} {!! TablerIcon::album() !!} {!! TablerIcon::brandGithub() !!} // Method 2: Using helper function {!! tabler_icon('home') !!} {!! tabler_icon('user', ['class' => 'text-blue-500']) !!} {!! tabler_icon('album') !!} // Method 3: Using global helper (without attributes) {!! TablerIcon()::home() !!} {!! TablerIcon()::album() !!} // Method 4: Through app container {!! app('tabler-icon')::home() !!} {!! app('tabler-icon')::user(['class' => 'text-blue-500']) !!}
Method Name Conversion
The facade automatically converts method names to icon names:
TablerIcon::home()→homeTablerIcon::album()→albumTablerIcon::userPlus()→user-plusTablerIcon::brandGithub()→brand-githubTablerIcon::heartFilled()→heart-filled
Numeric Icons (Special Handling):
TablerIcon::twelveHours()→12-hoursTablerIcon::twentyFourHours()→24-hoursTablerIcon::twoFa()→2faTablerIcon::threeDCubeSphere()→3d-cube-sphere
Note: Icons starting with numbers use word-based method names since PHP method names cannot start with numbers.
Available Methods
// Render an icon (multiple ways) TablerIcon::home(['class' => 'icon', 'style' => 'color: red;']) TablerIcon::album() tabler_icon('home', ['class' => 'icon']) TablerIcon()::home() // Note: global helper doesn't support attributes // Check if icon exists TablerIcon::exists('home') // returns bool TablerIcon::exists('album') // returns bool // Get all available icons TablerIcon::all() // returns array (6000+ icons) // Search for icons TablerIcon::search('user') // returns array of matching icons TablerIcon::search('brand') // returns array of brand icons
Working with Attributes
Only TablerIcon:: facade and tabler_icon() helper support attributes:
// ✅ Works - Facade with attributes {!! TablerIcon::user(['class' => 'w-8 h-8 text-blue-500']) !!} {!! TablerIcon::home(['style' => 'color: red; width: 32px;']) !!} // ✅ Works - Helper with attributes {!! tabler_icon('user', ['class' => 'icon-user', 'data-id' => '123']) !!} // ❌ Doesn't work - Global helper doesn't support attributes {!! TablerIcon()::user(['class' => 'test']) !!} // Attributes ignored // ✅ Alternative - Use Blade component for attributes <x-tabler-icons::user class="w-8 h-8 text-blue-500" />
Icon Browser & Testing
Main Icon Browser:
Visit /tabler-icons-demo route (in development environment) to browse all available icons with usage examples.
Features:
- Browse all 6000+ icons with pagination
- Search functionality
- 3 usage methods for each icon:
- Facade:
TablerIcon::iconName() - Helper Function:
tabler_icon('icon-name') - Blade Component:
<x-tabler-icons::icon-name />
- Facade:
Tailwind CSS Test Page:
Visit /tabler-icons-test route to see a comprehensive test page with Tailwind CSS styling examples.
Features:
- 🎨 Color variations - All Tailwind color classes
- 📏 Size variations - From w-4 h-4 to w-20 h-20
- ✨ Advanced styling - Drop shadows, rotations, scaling
- 🎬 Animations - Bounce, spin, pulse effects
- 🏢 Brand icons - Popular brand icons with proper colors
- 🔢 Numeric icons - Examples of number-based icons
- 💡 Usage tips - Best practices and conversion examples
Changelog
Please see CHANGELOG for more information what has changed recently.
License
The MIT License (MIT). Please see License File for more information.
vigstudio/laravel-tabler-icons 适用场景与选型建议
vigstudio/laravel-tabler-icons 是一款 基于 HTML 开发的 Composer 扩展包,目前已累计 360 次下载、GitHub Stars 达 1, 最近一次更新时间为 2023 年 11 月 07 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「laravel-tabler-icons」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 vigstudio/laravel-tabler-icons 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 vigstudio/laravel-tabler-icons 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 360
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 4
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-11-07