A composer ready package designed to integrate the fantastic Font Awesome icon set into your PHP projects through an easy to use interface.
Created with Laravel in mind, a ServiceProvider and Facade have been included as well.
Don't worry though, the library will work in any PHP application, via composer or manually.
"khill/fontawesomephp" : "~2.0"
composer update
Skip this step if you are not using Laravel
'Khill\Fontawesome\FontAwesomeServiceProvider'
FontAwesome::css() // Or FA::css() if you want to use the alias
include("[UNZIPPED_ARCHIVE]/src/FontAwesome.php");
public/css/font-awesome.min.css public/fonts/fontawesome-webfont.eot public/fonts/fontawesome-webfont.svg public/fonts/fontawesome-webfont.ttf public/fonts/fontawesome-webfont.wof public/fonts/FontAwesome.otf
<link href="[ASSET_DIR]/css/font-awesome.min.css" rel="stylesheet" />
echo FA::icon('star');
will output the icon html for you
<i class="fa fa-star"></i>
$fa = new FontAwesome; echo $fa->icon('star');
will output the icon html for you
<i class="fa fa-star"></i>
icon($iconLabel);
lg($iconLabel); x2($iconLabel); x3($iconLabel); x4($iconLabel); x5($iconLabel);
fixedWidth($iconLabel);
Example: (Laravel alias within blade template shown)
<ul class="nav nav-pills nav-stacked"> <li class="active"><a href="#">{{ FA::fixedWidth('home') }} Home</a></li> <li><a href="#">{{ FA::fixedWidth('flask') }} Science</a></li> <li><a href="#">{{ FA::fixedWidth('group') }} Connect</a></li> <li><a href="#">{{ FA::fixedWidth('upload') }} Upload</a></li> </ul>
ul('square')->li('list item one') ->li('list item two') ->li('list item three')
ul(array( 'magic' => 'This is my first item', 'music' => 'This is my second item', 'road' => 'This is my third item' ));
border('github'); left('camera'); right('cloud');
spin('question-circle') spin('refresh')
rotate90('pencil'); rotate180('leaf'); rotate270('gamepad'); flipHorizontal('signal'); flipVertical('tags');
stack('ban')->on('comments');
stack('square-o')->on('gavel')->lg(); stack('circle-o')->on('twitter')->x3();
x3('shopping-cart')->flipVertical();
rotate270('cutlery')->x3();
icon('truck')->x4()->inverse();
right('hospital')->border()->x2();
x3('cog')->store('savedIcon1'); //Store Icons echo collection('savedIcon1'); //Retrieve within template or HTML