bugo/fa-icon-builder
最新稳定版本:0.3
Composer 安装命令:
composer require bugo/fa-icon-builder
包简介
Dependency-free PHP toolset to generate Font Awesome icon classes, HTML tags, and collections (Solid/Regular/Brands). Perfect for projects where you need to work with FA icons without loading CSS/JS.
README 文档
README
Description
Dependency-free PHP toolset to generate Font Awesome icon classes, HTML tags, and collections (Solid/Regular/Brands). Perfect for projects where you need to work with FA icons.
Installation
composer require bugo/fa-icon-builder
Usage
A unique decorator is provided for each icon set:
// 'fa-brands fa-windows' echo BrandsIcon::make('windows'); // 'fa-regular fa-user' echo RegularIcon::make('user'); // 'fa-solid fa-user' echo SolidIcon::make('user');
If you need support for legacy classes, simply pass true as the second parameter:
// 'fas fa-user' echo SolidIcon::make('user', true);
Extended example:
$icon = Icon::make('user', IconStyle::Solid); // '<i class="fa-solid fa-user fa-2xl text-red-500 fa-fw" title="User" aria-hidden="true"></i>' var_dump( $icon ->color('text-red-500') ->size('2xl') ->title('User') ->fixedWidth() ->ariaHidden() ->html() );
Additional classes can be passed via the addClass method:
$icon = SolidIcon::make('heart'); // '<i class="fa-solid fa-heart fa-beat"></i>' var_dump( $icon ->addClass('fa-beat') ->html() );
Additionally, random icon retrieval is available:
var_dump(Icon::random());
You can retrieve the entire collection with all classes at once:
var_dump(Icon::collection());
Or a specific collection set:
var_dump(Icon::collection(IconStyle::Brands)); var_dump(BrandsIcon::collection());
You might also find the IconBuilder class useful, which can create an icon by its class:
var_dump(IconBuilder::make(Icon::random()));
统计信息
- 总下载量: 20
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-07-28