ki5an / laraicons
A Laravel package for integrating Iconify icons into reusable Blade components
Fund package maintenance!
Requires
- php: ^8.1
- iconify/json: ^2.2.525
- illuminate/console: ^10.0|^11.0|^12.0|^13.0
- illuminate/filesystem: ^10.0|^11.0|^12.0|^13.0
- illuminate/http: ^10.0|^11.0|^12.0|^13.0
- illuminate/support: ^10.0|^11.0|^12.0|^13.0
- illuminate/view: ^10.0|^11.0|^12.0|^13.0
- laravel/prompts: ^0.1.24|^0.2|^0.3
- symfony/console: ^6.0|^7.0|^8.0
Requires (Dev)
None
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
Generate reusable Laravel Blade components from Iconify icon sets.
LaraIcons lets you select icons from Iconify's large collection of open-source icon sets and generate them as native Laravel Blade components.
Installation
Install LaraIcons with Composer:
composer require ki5an/laraicons
Laravel discovers the service provider automatically. To publish the package configuration, run:
php artisan vendor:publish --tag=laraicons-config
This creates config/laraicons.php, where you can configure the Blade
component name, generated view path, and icons to sync.
Configuration
Bind the icons you want to generate in config/laraicons.php:
'view_path' => 'views/components/icon', 'component' => 'lara-icon', 'icons' => [ 'lucide' => [ 'activity', 'alarm-clock', ], 'heroicons' => [ 'home', 'heart', ], ],
view_path is the directory under resources/ where generated icon views are
stored. component is the Blade component prefix used when rendering icons:
<x-lara-icon name="lucide:activity" />
For example, changing component to app-icon lets you render the same icon
with <x-app-icon name="lucide:activity" />.
Usage
After syncing an icon, render it with the collection and icon name:
<x-lara-icon name="heroicons:home" class="h-5 w-5" />
Configure collections and icons in config/laraicons.php, then sync them:
php artisan icons:sync php artisan icons:sync --force
Use --force or the legacy override mode to replace generated files without
being prompted.