artisanpack-ui/icons
Register and use your own SVG icon sets in Laravel with minimal overhead. Integrates with blade-ui-kit/blade-icons and Livewire UI, supports config or event-based registration, and makes it easy to add premium sets like Font Awesome Pro.
This guide will help you migrate from v2.0 to v2.1. The v2.1 release migrates from the tormjens/eventy package to the new artisanpack-ui/hooks package for event/filter management.
The main change in v2.1 is the replacement of the tormjens/eventy package with artisanpack-ui/hooks. This affects how third-party packages register icon sets programmatically.
tormjens/eventy dependencyartisanpack-ui/hooks ^1.0 dependencyEventy::addFilter() to addFilter() global helperUpdate your composer.json:
{
"require": {
"artisanpack-ui/icons": "^2.1"
}
}
Run the update:
composer update artisanpack-ui/icons
If you have any packages that register icon sets programmatically, update the filter syntax:
Before (v2.0):
use TorMorten\Eventy\Facades\Eventy;
use ArtisanPackUI\Icons\Registries\IconSetRegistration;
// In your service provider
Eventy::addFilter('ap.icons.register-icon-sets', function (IconSetRegistration $registry) {
$registry->addSet(__DIR__ . '/../../resources/icons', 'mypackage');
return $registry;
});
After (v2.1):
use ArtisanPackUI\Icons\Registries\IconSetRegistration;
// In your service provider - no Eventy import needed
addFilter('ap.icons.register-icon-sets', function (IconSetRegistration $registry) {
$registry->addSet(__DIR__ . '/../../resources/icons', 'mypackage');
return $registry;
});
Remove any use TorMorten\Eventy\Facades\Eventy; imports from your files.
Verify that your icon sets are still registered correctly:
php artisan tinker
>>> app(BladeUI\Icons\Factory::class)->all()
config/artisanpack/icons.php) remains unchanged<x-icon-prefix-name />) remains unchangedartisanpack-ui/hooks package is purpose-built for LaravelThis guide will help you migrate from ArtisanPack UI Icons v1.x to v2.0. The v2.0 release represents a fundamental architectural change from a hardcoded icon provider to an extensibility layer for custom icon sets.
ArtisanPack UI Icons v2.0 transforms the package from providing thousands of hardcoded icons to being an extensibility layer that allows you to register and use your own custom icon sets with blade-ui-kit/blade-icons.
<x-icon-prefix-name /> components// ❌ REMOVED in v2.0
use ArtisanPackUI\Icons\Icons;
$icons = new Icons();
$allIcons = $icons->getIcons();
$iconsList = $icons->iconsList();
// ❌ REMOVED in v2.0
use ArtisanPackUI\Icons\Facades\Icons;
$allIcons = Icons::getIcons();
$iconsList = Icons::iconsList();
// ❌ REMOVED in v2.0
$allIcons = getIcons();
$iconsList = iconsLists();
$iconsService = icons();
{{-- ❌ REMOVED in v2.0 --}}
[@apIcons](https://github.com/apIcons)
// ❌ REMOVED in v2.0
$solidIcons = getIcons(['type' => 'solid']);
$navIcons = getIcons(['category' => 'navigation']);
$filteredIcons = getIcons(['category' => 'social', 'type' => 'regular']);
// ❌ REMOVED in v2.0 - No more asset routes or CSS serving
// Previously served at routes like /artisanpack-ui-icons/css
Update your composer.json:
{
"require": {
"artisanpack-ui/icons": "^2.0"
}
}
Run the update:
composer update artisanpack-ui/icons
php artisan vendor:publish --tag=artisanpack-package-config
Remove any usage of the old API:
// Remove these imports
use ArtisanPackUI\Icons\Icons;
use ArtisanPackUI\Icons\Facades\Icons;
// Remove these function calls
getIcons();
iconsLists();
icons();
Remove Blade directives:
{{-- Remove this --}}
[@apIcons](https://github.com/apIcons)
Since v2.0 doesn't include hardcoded icons, you need to source your own:
# Extract Font Awesome Pro SVGs to resources/icons/
unzip fontawesome-pro-6.x.x-web.zip
cp -r fontawesome-pro-6.x.x-web/svgs/* resources/icons/fontawesome/
Download free icon sets like Heroicons, Tabler Icons, or Feather:
# Example: Heroicons
mkdir resources/icons/heroicons
# Download SVG files to this directory
Place your custom SVG files in organized directories:
resources/
└── icons/
├── custom/
│ ├── logo.svg
│ └── brand.svg
└── ui/
├── save.svg
└── cancel.svg
Edit config/artisanpack/icons.php:
return [
'sets' => [
[
'path' => resource_path('icons/fontawesome/solid'),
'prefix' => 'fas',
],
[
'path' => resource_path('icons/fontawesome/regular'),
'prefix' => 'far',
],
[
'path' => resource_path('icons/heroicons'),
'prefix' => 'hero',
],
[
'path' => resource_path('icons/custom'),
'prefix' => 'custom',
],
],
];
Replace old icon usage with new Blade components:
{{-- Old v1.x approach --}}
[@apIcons](https://github.com/apIcons)
<i class="ap-icon ap-icon-home"></i>
<i class="ap-icon ap-icon-user"></i>
{{-- New v2.0 approach --}}
<x-icon-fas-home class="w-6 h-6" />
<x-icon-hero-user class="w-5 h-5 text-blue-500" />
Old v1.x:
$icons = getIcons(['category' => 'navigation']);
foreach ($icons as $iconName => $iconData) {
echo "<i class='ap-icon ap-icon-{$iconName}'></i>";
}
New v2.0:
[@php](https://github.com/php)
$navIcons = ['home', 'menu', 'search', 'settings'];
[@endphp](https://github.com/endphp)
[@foreach](https://github.com/foreach)($navIcons as $icon)
<x-dynamic-component :component="'icon-hero-' . $icon" class="w-5 h-5" />
[@endforeach](https://github.com/endforeach)
Old v1.x:
$userIcon = 'user';
$iconData = getIcons()[$userIcon] ?? null;
if ($iconData) {
echo "<i class='ap-icon ap-icon-{$userIcon}'></i>";
}
New v2.0:
[@php](https://github.com/php) $userIcon = 'user'; [@endphp](https://github.com/endphp)
<x-dynamic-component :component="'icon-fas-' . $userIcon" class="w-5 h-5" />
Old v1.x:
$availableIcons = array_keys(getIcons());
New v2.0:
// Create your own icon registry
$availableIcons = [
'fas' => ['home', 'user', 'settings'],
'hero' => ['bell', 'calendar', 'chart'],
'custom' => ['logo', 'brand'],
];
Old v1.x:
[@apIcons](https://github.com/apIcons)
<nav>
<a href="/home"><i class="ap-icon ap-icon-home"></i> Home</a>
<a href="/profile"><i class="ap-icon ap-icon-user"></i> Profile</a>
<a href="/settings"><i class="ap-icon ap-icon-cog"></i> Settings</a>
</nav>
New v2.0:
<nav>
<a href="/home" class="flex items-center">
<x-icon-fas-home class="w-5 h-5 mr-2" /> Home
</a>
<a href="/profile" class="flex items-center">
<x-icon-fas-user class="w-5 h-5 mr-2" /> Profile
</a>
<a href="/settings" class="flex items-center">
<x-icon-fas-cog class="w-5 h-5 mr-2" /> Settings
</a>
</nav>
Old v1.x:
[@php](https://github.com/php)
$actions = [
'save' => ['icon' => 'save', 'label' => 'Save'],
'cancel' => ['icon' => 'times', 'label' => 'Cancel'],
];
[@endphp](https://github.com/endphp)
[@foreach](https://github.com/foreach)($actions as $action => $data)
<button class="btn">
<i class="ap-icon ap-icon-{{ $data['icon'] }}"></i>
{{ $data['label'] }}
</button>
[@endforeach](https://github.com/endforeach)
New v2.0:
[@php](https://github.com/php)
$actions = [
'save' => ['icon' => 'fas-save', 'label' => 'Save'],
'cancel' => ['icon' => 'fas-times', 'label' => 'Cancel'],
];
[@endphp](https://github.com/endphp)
[@foreach](https://github.com/foreach)($actions as $action => $data)
<button class="btn flex items-center">
<x-dynamic-component :component="'icon-' . $data['icon']" class="w-4 h-4 mr-2" />
{{ $data['label'] }}
</button>
[@endforeach](https://github.com/endforeach)
Old v1.x:
$availableIcons = getIcons(['category' => 'interface']);
New v2.0:
// Define your available icons explicitly
$availableIcons = [
'interface' => [
'fas-home' => 'Home',
'fas-user' => 'User',
'fas-cog' => 'Settings',
'hero-bell' => 'Notifications',
'hero-calendar' => 'Calendar',
],
];
Problem: Icons don't appear after migration.
Solutions:
php artisan config:clear && php artisan view:clearProblem: Old version consumed too much memory.
Solution: v2.0 eliminates this issue entirely by removing hardcoded icon arrays. Memory usage is now minimal.
Problem: Specific icons from v1.x are no longer available.
Solutions:
Problem: Icons loading slowly.
Solutions:
Problem: Package relied on old icon system.
Solutions:
If you encounter issues during migration:
config/artisanpack/icons.phpAfter completing your migration:
How can I help you explore Laravel packages today?