Skip to content

Easily inline Font Awesome 5 icons in your Blade templates

License

Notifications You must be signed in to change notification settings

depsimon/blade-fa5

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Blade FontAwesome 5

Easily inline Font Awesome 5 icons in your Blade templates. Heavily inspired by the great [adamwathan/blade-svg].

Installation

You can install this package via Composer by running this command in your terminal in the root of your project:

composer require depsimon/blade-fa5

Getting started

Publish the Blade Font Awesome 5 config file:

php artisan vendor:publish --provider="Depsimon\BladeFa5\BladeFa5ServiceProvider"

Download the Font Awesome 5 latest version (Free or Pro) and put the SVG sprites in your public/svg directory.

Configuration

Inside config/blade-fa5.php, you can specify the spritesheets directory, the default weight and the default classes for icons.

<?php

return [
    'spritesheets_url' => 'svg/',
    'weight' => 'far',
    'class' => 'icon inline-block fill-current',
];

Basic usage

You can insert an icon anywhere in your template with the @fa5 Blade directive. You pass the name, then the weight, the classes and any additional classes:

@fa5('cog')
@fa5('user', 'fas') <!-- Weight is "solid" -->
@fa5('facebook', 'fab', 'text-blue') <!-- Weight is "brands" and apply "text-blue" class -->
@fa5('spinner', 'fal', 'text-grey', ['spin']) <!-- Add the "spin" attribute -->

Credits

License

The MIT License (MIT). Please see License File for more information.