Font Awesome for Yii2
Installation
The preferred way to install this extension is through composer., (*1)
To install, either run, (*2)
$ php composer.phar require "blackho1e/yii2-fontawesome" "*"
or add, (*3)
"blackho1e/yii2-fontawesome" : "*"
to the require
section of your composer.json
file., (*4)
Assets
To include Font Awesome assets, you should register it in view :, (*5)
\blackho1e\fontawesome\FontAwesomeAsset::register($this);
Or as dependency in your app asset bundle :, (*6)
public $depends = [
'blackho1e\fontawesome\FontAwesomeAsset',
];
Usage
use blackho1e\fontawesome\FontAwesome as FA;
// home icon : <i class="fa fa-home"></i>
echo FA::icon('home');
// 2x home icon : <i class="fa fa-home fa-2x"></i>
echo FA::icon('home 2x');
// fixed width home icon : <i class="fa fa-home fa-fw"></i>
echo FA::icon('home fw');