Download the PHP package abdulrahman-dev22/filament-icon-picker without Composer

On this page you can find all versions of the php package abdulrahman-dev22/filament-icon-picker. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package filament-icon-picker

Filament Icon Picker

A drop-in icon picker form field for Filament v3, v4 and v5.

IconPicker::make('icon') renders a searchable grid of icons organised into tabs: one tab for the bundled Heroicons, plus a tab for every custom SVG folder or custom icon set you register. The selected icon is stored as a single string (heroicons:o-academic-cap, brand:logo) that you can render anywhere in your app.

Requirements

Package Supported versions
PHP 8.1+
Filament (forms) ^3.0, ^4.0, ^5.0 (panels or standalone forms)
Laravel 10.45+, 11, 12, 13 (whatever your Filament version needs)

Heroicons are pulled in through blade-ui-kit/blade-heroicons, which every supported Filament version already depends on.

Installation

Publish the field's stylesheet with Filament's asset command. Panel projects that have @php artisan filament:upgrade in their composer.json post-autoload-dump scripts (the default from filament:install) do this automatically:

Optionally publish the config file:

Notes per Filament version

Usage

Bundled Heroicons only

Stores e.g. heroicons:o-academic-cap.

By default only the outline style is listed (324 icons). Enable more styles in the config:

Custom icons from a folder

Every .svg in that folder becomes an icon. The file name (without extension) is the icon name and the default label (shopping-bag.svg → Shopping Bag). Nested folders are joined with a dot (social/twitter.svg → social.twitter). Stored value: brand:shopping-bag.

To make a folder available to every IconPicker in the project, configure it globally instead:

Globally registered folders are also registered with Blade Icons under the set key as prefix, so the stored value doubles as a plain icon name everywhere Filament accepts one: ->icon('brand-shopping-bag'), <x-filament::icon icon="brand-shopping-bag" />, @svg('brand-shopping-bag'). (Blade Icons prefixes cannot contain dashes; for such keys the picker falls back to rendering the SVG inline and you should use the Blade component below.)

Both, and several custom tabs

Renders three tabs: Heroicons, Brand, Flags.

Excluding sets, or ignoring the global registry

Registering a fully custom icon set

Implement AbdulrahmanDev22\FilamentIconPicker\IconSets\IconSet:

Register it globally through the config (classes are resolved from the container):

…or at runtime in a service provider:

…or for a single field (a set with the same key as a global one replaces it for that field only):

The bundled sets are ordinary implementations of the same interface, so you can also pass new HeroiconsIconSet(styles: ['s'], label: 'Solid') or new CustomIconSet($path, $key, $label).

Field API

Method Description
customIconsPath(string\|Closure $path, string $key = 'custom', string\|Closure\|null $label = null) Add a tab for a folder of SVGs. Repeat with different keys for more tabs.
icons(array\|Closure $sets, bool $merge = true) Add IconSet instances or class names. merge: false ignores the global registry.
withoutIconSet(string ...$keys) / withoutHeroicons() Hide globally registered sets from this field.
withoutGlobalIconSets() Use only sets added to this field.
columns(int\|array\|Closure $columns) Grid columns. 8 applies at every breakpoint; ['default' => 4, 'md' => 6, 'xl' => 10] per breakpoint. Default ['default' => 4, 'sm' => 6, 'lg' => 8].
searchable(bool $condition = true) Toggle the search box (on by default). Also searchPrompt(), searchDebounce(), noSearchResultsMessage().
deselectable(bool $condition = true) Clicking the selected icon again clears the value (on by default).
gridMaxHeight(string $cssLength) Height after which the grid scrolls. Default 20rem.
placeholder(string $text) Text shown while nothing is selected.
storeAs(...) / storeAsReference() / storeAsBladeIcon() / storeAsArray() / storeAsJson() / storeAsSvg() How the value is written to the model. See Storage formats.
uploadable(bool\|Closure $condition = true, ?string $set = null) / uploadIconsTo() / uploadMaxSize() / uploadAction() Show an "Upload icon" action. See Letting users upload icons.

Plus everything from Filament's Field: label(), required(), disabled(), default(), live(), afterStateUpdated(), rules(), hidden(), columnSpan(), etc.

The field validates automatically that a submitted value belongs to one of the field's icon sets.

Storage formats

Internally the picker always works with a reference: "<set-key>:<icon-name>", e.g. heroicons:o-academic-cap or brand:star. No file paths are ever stored. What gets written to the model is up to you, per field or globally (storage_format in the config):

Method Stored value Column Best for
storeAsReference() (default) brand:star string Compact, unambiguous; resolve with the facade.
storeAsBladeIcon() brand-star, heroicon-o-academic-cap string Drop straight into ->icon(), <x-filament::icon>, @svg(). Sets whose key contains a dash cannot produce one and store null.
storeAsArray() ['set', 'name', 'label', 'blade_icon', 'svg', 'url'] json + 'icon' => 'array' cast API responses without any lookup.
storeAsJson() Same structure, JSON-encoded text Same, without an Eloquent cast.
storeAsSvg() <svg …>…</svg> text Fully self-contained clients. Heaviest; icon changes do not propagate.

storeAsArray() needs a JSON column and an array cast on the model, otherwise Eloquent cannot save the array:

On Laravel 10 use the $casts property instead: protected $casts = ['icon' => 'array'];. storeAsJson() does the same job without a cast if you prefer a plain text column.

Whatever the format, loading a record converts the stored value back to a reference so the picker shows the current selection. Existing data keeps working if you switch format later, because the converter accepts every format on the way in (it even matches raw SVG markup back to its icon).

Rendering the value elsewhere

All helpers accept any storage format (reference, Blade Icons name, array, JSON string or SVG). The set only needs to be registered globally, not on the field, to resolve outside the form.

API responses

url is null until you enable the icon route. It serves every globally registered icon as an SVG file with long-lived cache headers, so mobile apps and CDNs can load icons by URL:

GET /filament-icon-picker/{set}/{name}.svg → image/svg+xml, 404 for unknown icons. FilamentIconPicker::url('brand:star') returns the same link.

AbdulrahmanDev22\FilamentIconPicker\Support\IconReference::from($value) splits a reference into ->set and ->name when you need the parts.

Letting users upload icons

Icons normally come from the filesystem you deploy. To let admins add icons at runtime, give the picker a set that lives on a Laravel disk and turn on the upload action:

An "Upload icon" link appears next to the selected value. It opens a modal with an SVG file input and an optional name; on submit the file is sanitised (scripts, event handlers, <foreignObject>, external and javascript: references and unsafe <style> rules are removed), stored as {directory}/{name}.svg, the set's cache is refreshed and the new icon is selected.

Caching

Icon folders are scanned once per request. To avoid touching the filesystem on every request in production, the resolved list of each set can be cached:

After adding or removing SVG files with caching enabled, clear the cached lists:

php artisan cache:clear works too. Sets you implement yourself decide their own caching; use the AbdulrahmanDev22\FilamentIconPicker\IconSets\Concerns\CachesIconList trait to opt into the same mechanism.

How multi-version support works

The field extends Filament\Forms\Components\Field and only touches Filament through extension points that are stable across 3, 4 and 5: the field wrapper view is resolved with $getFieldWrapperView(), state is bound with $applyStateBindingModifiers() / $entangle, shared Blade components (x-filament::input.wrapper) are used for the search box, and the stylesheet is registered through FilamentAsset. Colours use a CSS var() fallback chain so the same file works with Filament 3's RGB channel variables and Filament 4/5's oklch variables. Nothing in the package branches on the Filament version.

Testing

The suite covers icon set enumeration, the registry, the field's set resolution, value parsing and rendering, plus Livewire render / round-trip / validation tests for the field.

Publishing under another vendor name

The package is published as abdulrahman-dev22/filament-icon-picker with the AbdulrahmanDev22\FilamentIconPicker namespace. To fork it under your own name:

  1. Replace the namespace AbdulrahmanDev22\FilamentIconPicker with Acme\FilamentIconPicker in src/, tests/, resources/views/ and composer.json (autoload, autoload-dev, extra.laravel).
  2. Change name, homepage and authors in composer.json, and FilamentIconPickerServiceProvider::$composerPackage (used as the asset package id).
  3. Optionally rename the config key / view namespace filament-icon-picker (FilamentIconPickerServiceProvider::$name, config/, the $view property of IconPicker, translation keys and <x-filament-icon-picker::icon>).
  4. Update LICENSE.md and this README.
  5. Run composer validate --strict and composer test.
  6. Push to GitHub, tag a release (git tag v1.0.0 && git push --tags) and submit the repository on packagist.org. Enable the GitHub service hook so new tags are picked up automatically.

Follow Semantic Versioning: patch for fixes, minor for backwards compatible features (new field methods, new sets), major for changes to the IconSet contract or the stored value format.

Changelog

See CHANGELOG.md.

License

MIT. See LICENSE.md.


All versions of filament-icon-picker with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
ext-dom Version *
blade-ui-kit/blade-heroicons Version ^2.5
blade-ui-kit/blade-icons Version ^1.5
filament/forms Version ^3.0|^4.0|^5.0
illuminate/contracts Version ^10.45|^11.0|^12.0|^13.0
spatie/laravel-package-tools Version ^1.9
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package abdulrahman-dev22/filament-icon-picker contains the following files

Loading the files please wait ...