nerdroid23 / blade-icomoon
A package to easily make use of "IcoMoon" in your Laravel Blade views.
Fund package maintenance!
nerdroid23
Installs: 43 030
Dependents: 0
Suggesters: 1
Security: 0
Stars: 2
Watchers: 1
Forks: 3
Open Issues: 1
Requires
- php: ^7.4|^8.0
- blade-ui-kit/blade-icons: ^1.5
- illuminate/support: ^8.0|^9.0||^10.0
- spatie/laravel-package-tools: ^1.4.3
Requires (Dev)
- brianium/paratest: ^6.2
- liip/rmt: ^1.6
- nunomaduro/collision: ^5.3
- orchestra/testbench: ^6.0|^7.0|^8.0
- phpunit/phpunit: ^9.3
README
Blade IcoMoon
A package to easily make use of IcoMoon in your Laravel Blade views.
For a full list of available icons see the SVG directory.
Requirements
- PHP 7.4 or higher
- Laravel 8.0 or higher
Install
You can install the package via composer:
composer require nerdroid23/blade-icomoon
Configuration
Blade IcoMoon also offers the ability to use features from Blade Icons like default classes, default attributes, etc. If you'd like to configure these, publish the blade-icomoon.php
config file:
You can publish the config file with:
php artisan vendor:publish --provider="Nerdroid23\BladeIcomoon\BladeIcomoonServiceProvider" --tag="blade-icomoon-config"
This is the contents of the published config file:
return [ /* |----------------------------------------------------------------- | Default Prefix |----------------------------------------------------------------- | | This config option allows you to define a default prefix for | your icons. The dash separator will be applied automatically | to every icon name. It's required and needs to be unique. | */ 'prefix' => 'icomoon', /* |----------------------------------------------------------------- | Fallback Icon |----------------------------------------------------------------- | | This config option allows you to define a fallback | icon when an icon in this set cannot be found. | */ 'fallback' => '', /* |----------------------------------------------------------------- | Default Set Classes |----------------------------------------------------------------- | | This config option allows you to define some classes which | will be applied by default to all icons within this set. | */ 'class' => '', /* |----------------------------------------------------------------- | Default Set Attributes |----------------------------------------------------------------- | | This config option allows you to define some attributes which | will be applied by default to all icons within this set. | */ 'attributes' => [ // 'fill' => 'currentColor', // 'width' => 32, // 'height' => 32, ], ];
Usage
Icons can be used a self-closing Blade components which will be compiled to SVG icons:
<x-icomoon-500px />
You can also pass classes to your icon components:
<x-icomoon-500px class="w-6 h-6 text-red-500" />
And even use inline styles:
<x-icomoon-500px style="color: red" />
Raw SVG Icons
If you want to use the raw SVG icons as assets, you can publish them using:
php artisan vendor:publish --tag=blade-icomoon-icons --force
Then use them in your views like:
<img src="{{ asset('vendor/blade-icomoon/500px.svg') }}" width="24" height="24"/>
Blade Icons
Blade IcoMoon uses Blade Icons under the hood. Please refer to the Blade Icons readme for additional functionality.
Testing
composer test
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
License
The MIT License (MIT). Please see License File for more information.