PHP code example of tonegabes / filament-phosphor-icons
1. Go to this page and download the library: Download tonegabes/filament-phosphor-icons library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
tonegabes / filament-phosphor-icons example snippets
use Filament\Actions\Action;
use Filament\Forms\Components\Toggle;
use ToneGabes\Filament\Icons\Enums\Phosphor;
Action::make('star')
->icon(Phosphor::StarBold);
Toggle::make('is_starred')
->onIcon(Phosphor::Star)
enum Weight: string
{
case Thin = 'thin';
case Light = 'light';
case Fill = 'fill';
case Duotone = 'duotone';
case Bold = 'bold';
case Regular = 'regular';
}
use Filament\Forms\Components\Toggle;
use ToneGabes\Filament\Icons\Enums\Phosphor;
use ToneGabes\Filament\Icons\Enums\Weight;
// Simple
Toggle::make('is_starred')
->onIcon(Phosphor::StarFill)
->offIcon(Phosphor::Star)
;
// Forcing with enum
Toggle::make('is_starred')
->onIcon(Phosphor::Star->forceWeight(Weight::Fill))
->offIcon(Phosphor::Star->forceWeight(Weight::Regular));
// You can use 'forceWeight' to set weight based on a variable
Action::make('star')->icon(Phosphor::StarBold->forceWeight($var));
// Overrides the default bold case to another at runtime
->icon(Phosphor::StarBold->thin());
->icon(Phosphor::StarBold->light());
->icon(Phosphor::StarBold->regular());
->icon(Phosphor::StarBold->fill());
->icon(Phosphor::StarBold->bold());
->icon(Phosphor::StarBold->duotone());
@php
use ToneGabes\Filament\Icons\Enums\Phosphor;
@endphp
// Use it as attribute
<x-filament::badge :icon="Phosphor::Star">
Star
</x-filament::badge>
// Use it as svg directive
@svg(Phosphor::Star->getLabel())
// Use it as svg helper
{{ svg(Phosphor::Star->getLabel()) }}
// Use it as component
<x-icon name="{{ Phosphor::Star->getLabel() }}" />
php artisan phosphor:sync
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.