lucasruroken/laravel-font-awesome

Helper class to build FontAwesome icons



Documentation

Digbang/FontAwesome

Fake build status

Helper class to create FontAwesome icons with a predefined markup.

Usage

Basic usage

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

Would result in...

<i class="fa fa-icon extra-class"></i>

HTML Attributes

You can also add any other attributes to the html. Doing...

FontAwesome::icon('times', ['title' => 'Delete this!'])

would result in...

<i class="fa fa-times" title="Delete this!"></i>

Changing the tag

You can change the tag used by the library. Doing...

FontAwesome::setTag('span');
FontAwesome::icon('edit');

would result in...

<span class="fa fa-edit"></span>

Laravel

Add the service provider and facade to your app/config/app.php file:

'providers' => array(
    ...
    'Digbang\FontAwesome\FontAwesomeServiceProvider',
    ...
);

And add the class alias, so you can call it like \FontAwesome::icon

'aliases' => array(
    ...
    'FontAwesome' => 'Digbang\FontAwesome\Facade',
    ...
);