Installation
Requirements
- PHP 8.2 or higher
- Filament 5.x
- blade-icons 1.8 or higher, which composer installs for you
Installing the package
You can install the package via composer:
composer require guava/filament-icon-picker
Next, publish the package assets:
php artisan filament:assets
Custom theme
A custom filament theme is required, otherwise the CSS of the picker is not built and the field will look broken.
If you don't have one yet, please read the filament documentation on how to create a custom theme.
Once you have a theme, add the following to your theme.css file:
@source '../../../../vendor/guava/filament-icon-picker/resources/**/*';
Icon endpoints
The package registers two routes of its own, which is how the picker gets its icons into the browser:
/_icon-picker/index
/_icon-picker/svgs
You don't have to register or configure anything for this, it happens automatically. Both routes are secured by an encrypted token that is issued when the field renders, so they only ever hand out the sets and the scope that the field itself offers.
If you cache your routes, remember to rebuild the cache after installing:
php artisan optimize
The URI prefix and the middleware of both routes can be changed, see configuration.
Configuration
The package works without any configuration. If you want to change the caching, the routes or the token lifetime, publish the config file:
php artisan vendor:publish --tag=filament-icon-picker-config
Everything in it is explained in configuration.
Custom icon uploads
If you want your users to upload their own icons, you also need a public storage link, since uploaded icons are stored on the public disk:
php artisan storage:link
Everything else is covered in enabling uploads.