An Phosphor icon set implementation for Filament Icons, allowing for instant replacement of all icons used within the Filament framework.
You can install the package via composer:
composer require filafly/filament-phosphor-icons
After the package is installed, you must register the plugin in your Filament Panel provider:
use Filafly\Icons\Phosphor\PhosphorIcons;Â public function panel(Panel $panel): Panel{ return $panel ->plugin(PhosphorIcons::make());}
Phosphor icons come in multiple styles that you can switch between. Available styles include:
You can change the style using the following methods:
PhosphorIcons::make()->thin();PhosphorIcons::make()->light();PhosphorIcons::make()->regular();PhosphorIcons::make()->bold();PhosphorIcons::make()->fill();PhosphorIcons::make()->duotone();
If you need to override certain icons to use a different style, you can use either icon aliases or icon enum cases.
Use the overrideStyleForAlias
method with a Filament Icon Alias. This method works with either a single icon key (string) or multiple icon keys (array).
use Filafly\Icons\Phosphor\PhosphorIcons;use Filafly\Icons\Phosphor\Enums\PhosphorStyle;use Filament\Tables\View\TablesIconAlias;use Filament\Actions\View\ActionsIconAlias;Â // Override a single icon keyPhosphorIcons::make()->overrideStyleForAlias(TablesIconAlias::ACTIONS_FILTER, PhosphorStyle::Solid);Â // Override multiple icon keys at oncePhosphorIcons::make()->overrideStyleForAlias([ TablesIconAlias::ACTIONS_FILTER, ActionsIconAlias::DELETE_ACTION,], PhosphorStyle::Solid);
Use the overrideStyleForIcon
method with Phosphor enum case(s). Like the alias method, this works with either a single case or an array of cases.
use Filafly\Icons\Phosphor\PhosphorIcons;use Filafly\Icons\Phosphor\Enums\Phosphor;use Filafly\Icons\Phosphor\Enums\PhosphorStyle;Â // Override a single iconPhosphorIcons::make()->overrideStyleForIcon(Phosphor::User, PhosphorStyle::Solid);Â // Override multiple icons at oncePhosphorIcons::make()->overrideStyleForIcon([ Phosphor::MagnifyingGlass, Phosphor::Funnel,], PhosphorStyle::Solid);
You can also specify exactly which icon you would like to use in given situations. This can be done via icon aliases or icon enum cases.
Use overrideAlias()
to change which icon is used for specific Filament icon aliases:
use Filafly\Icons\Phosphor\PhosphorIcons;use Filafly\Icons\Phosphor\Enums\Phosphor;use Filament\View\PanelsIconAlias;use Filament\Tables\View\TablesIconAlias;Â PhosphorIcons::make() ->overrideAlias(PanelsIconAlias::SIDEBAR_EXPAND_BUTTON, Phosphor::CaretRight) ->overrideAlias(TablesIconAlias::ACTIONS_FILTER, Phosphor::Funnel);
Or use overrideAliases()
to override multiple aliases at once by passing an array:
use Filafly\Icons\Phosphor\PhosphorIcons;use Filafly\Icons\Phosphor\Enums\Phosphor;use Filament\View\PanelsIconAlias;use Filament\Tables\View\TablesIconAlias;Â PhosphorIcons::make() ->overrideAliases([ PanelsIconAlias::SIDEBAR_EXPAND_BUTTON => Phosphor::CaretRight, TablesIconAlias::ACTIONS_FILTER => Phosphor::Funnel, ]);
Use overrideIcon()
to replace specific Phosphor icons with different ones:
use Filafly\Icons\Phosphor\PhosphorIcons;use Filafly\Icons\Phosphor\Enums\Phosphor;Â PhosphorIcons::make() ->overrideIcon(Phosphor::MagnifyingGlass, Phosphor::MagnifyingGlassThin) ->overrideIcon(Phosphor::Plus, Phosphor::PlusCircle);
Or use overrideIcons()
to override multiple icons at once by passing an array:
use Filafly\Icons\Phosphor\PhosphorIcons;use Filafly\Icons\Phosphor\Enums\Phosphor;Â PhosphorIcons::make() ->overrideIcons([ Phosphor::MagnifyingGlass->value => Phosphor::MagnifyingGlassThin, Phosphor::Plus->value => Phosphor::PlusCircle, Phosphor::Edit->value => Phosphor::EditPencil, ]);
PHP arrays do not support enums as keys so
->value
is necessary if you want to reference the enum
These methods are useful for fine-tuning the icon set to better fit your application's needs.
All icons are available through an enum providing convenient usage throughout Filament. For more information, check the Filament docs.
use Filament\Forms\Components\Toggle;use Filafly\Icons\Phosphor\Enums\Phosphor;Â Toggle::make('is_starred') ->onIcon(Phosphor::Star)
The MIT License (MIT). Please see License for more information.