digbang/font-awesome

此包已被废弃,不再维护。作者建议使用 digbang/fonts 包。
此包的最新版本(2.2.0)没有提供许可信息。

构建 FontAwesome 图标的辅助类

2.2.0 2016-11-11 15:40 UTC

This package is not auto-updated.

Last update: 2022-02-01 12:49:12 UTC


README

Fake build status

使用预定义标记创建 FontAwesome 图标的辅助类。

安装

通过 composer 下载

composer require digbang/font-awesome

将服务提供者和外观添加到您的 config/app.php

'providers' => [
    // ...
    Digbang\FontAwesome\FontAwesomeServiceProvider::class,
    
],

'aliases' => [
    // ...
    'FontAwesome' => Digbang\FontAwesome\Facade::class,
],

使用方法

通过外观

FontAwesome::icon('icon', 'extra-class') // <i class="fa fa-icon extra-class"></i>
// or...
FontAwesome::icon('icon', ['class' => 'extra-class']) // <i class="fa fa-icon extra-class"></i>

通过辅助函数

fa('icon', 'extra-class') // <i class="fa fa-icon extra-class"></i>
// or...
fa('icon', ['class' => 'extra-class']) // <i class="fa fa-icon extra-class"></i>

HTML 属性

您还可以向 html 添加其他任何属性。这样做...

fa('times', ['title' => 'Delete this!']) // <i class="fa fa-times" title="Delete this!"></i>

更改标签

您可以更改库使用的标签。这样做...

FontAwesome::setTag('span');

fa('edit'); // <span class="fa fa-edit"></span>

独立使用

非 Laravel 项目仍然可以使用此包,但外观和辅助函数将不可用。

$fa = new Digbang\FontAwesome\FontAwesome;
$fa->setTag('span');
$fa->icon('times', 'text-danger'); // <span class="fa fa-times text-danger"></span>