PHP code example of asignua / filament-rating

1. Go to this page and download the library: Download asignua/filament-rating 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/ */

    

asignua / filament-rating example snippets


use Asignua\FilamentRating\RatingPlugin;

$panel->plugin(RatingPlugin::make());

use Asignua\FilamentRating\Columns\RatingColumn;
use Asignua\FilamentRating\Components\Rating;
use Asignua\FilamentRating\Entries\RatingEntry;

// Form
Rating::make('rating')->

Rating::make('quality')
    ->tooltips([1 => 'Poor', 3 => 'Good', 5 => 'Excellent'])
    ->allowZero();

// half steps need string keys: PHP truncates a float array key
Rating::make('rating')->halfStars()->tooltips(['4.5' => 'Almost perfect']);

// or compute it
Rating::make('rating')->tooltips(fn (float $value): ?string => $value >= 4 ? 'Recommended' : null);

RatingColumn::make('rating')->halfStars()->showValue()->size('xs');

RatingEntry::make('rating')->halfStars()->showValue()->size('lg')->color('warning');

Rating::make('love')->icon('heroicon-s-heart')->emptyIcon('heroicon-o-heart')->color('danger')->stars(7);