orchid / blade-icons
An easy way inline SVG images in your Blade templates.
Fund package maintenance!
Open Collective
Installs: 530 232
Dependents: 7
Suggesters: 0
Security: 0
Stars: 9
Watchers: 3
Forks: 2
Open Issues: 0
Requires
- ext-dom: *
- laravel/framework: ^9.0
Requires (Dev)
- orchestra/testbench: ^7.0
- phpunit/phpunit: ^9.0
README
Introduction
This is a package for the Laravel framework that allows you to use the Blade component to insert inline SVG images.
Installation
Run this at the command line:
$ composer require orchid/blade-icons
This will update composer.json
and install the package into the vendor/
directory.
Base Usage
Register a directory with your files in the service provider:
namespace App\Providers; use Orchid\Icons\IconFinder; use Illuminate\Support\ServiceProvider; class AppServiceProvider extends ServiceProvider { public function boot(IconFinder $iconFinder) : void { $iconFinder->registerIconDirectory('fa', storage_path('app/fontawesome')); } }
When calling the directory method with the first argument, we pass the prefix to call our icons and the second directory where they are located.
After that, we can call the component in our blade templates:
<x-orchid-icon path="fa.home" />
If you use one or two sets of icons that do not repeat, then it is not necessary to specify a prefix in the component:
<x-orchid-icon path="home" />
You can also list some attributes that should be applied to your icon:
<x-orchid-icon path="home" class="icon-big" width="2em" height="2em" />
License
The MIT License (MIT). Please see License File for more information.