ibrahimbougaoua/filament-rating-star
Add interactive star ratings to Laravel Filament apps. Provides a clickable rating field for forms and a display column for tables, with configurable star counts, colors, and read-only modes for showing scores in admin panels. Simple to install and customize.
Install the package with Composer and publish assets if your Filament setup requires it:
composer require ibrahimbougaoua/filament-rating-star
php artisan filament:assets
There is no service provider/plugin registration step for the field and column classes; they are ordinary Filament components you import directly.
Look first at:
vendor/ibrahimbougaoua/filament-rating-star/src/ — especially the field component class — since the API surface is small and the source is the most reliable reference for your installed version.config/filament-rating-star.php) if the package exposes defaults for star count, size, or color.Your first useful case is a review/feedback resource. Add an integer rating column and a star field:
use IbrahimBougaoua\FilamentRatingStar\Forms\Components\RatingStar;
use IbrahimBougaoua\FilamentRatingStar\Columns\RatingStarColumn;
// In the form schema
RatingStar::make('rating')
->label('Rating')
->required(),
// In the table
RatingStarColumn::make('rating'),
That gives you an interactive star selector in the form and a read-only star display in the table, which is enough to ship a basic "rate this item" workflow.
Use it as a standard Filament field. Because RatingStar extends Filament's field component, normal field APIs work: ->required(), ->rules(), ->default(), ->columnSpan(), ->disabled(), ->dehydrated(), and ->live(). Keep validation on the field rather than relying on the widget:
RatingStar::make('rating')
->required()
->rules(['integer', 'min:1', 'max:5'])
->default(5),
Store an integer, not a formatted string. The field writes a numeric value to the model. Use an unsignedTinyInteger (or small integer) column, and cast it if you want type safety:
protected $casts = [
'rating' => 'integer',
];
Pair the form field with the table column. The common pattern is an editable form plus a compact column in the list view. If you want inline editing from the table, use the field package's table field/inline variant if your version provides one; otherwise use TextColumn with the star column for display and edit via the form.
Make columns sortable/filterable only on real DB columns. The column renders stars but sorting/filtering happens against the underlying attribute:
RatingStarColumn::make('rating')
->sortable()
->searchable(false),
Handle averages separately. The column expects a single rating. For an aggregate ("4.3 out of 5"), use a TextColumn with number_format($record->reviews_avg_rating, 1) and keep the star component for individual rows.
Read-only display in infolists and detail pages. Use the column component (or the field with ->disabled()) in infolist schemas so detail views stay visually consistent with the list.
Compose with other review fields. A typical review form schema:
RatingStar::make('rating')->required(),
Textarea::make('comment')->rows(4)->columnSpanFull(),
Toggle::make('is_approved'),
Keep it reactive when the rating changes. With ->live(), other fields can react — e.g. show a "low rating requires a comment" notice:
RatingStar::make('rating')->live(),
Textarea::make('comment')
->required(fn (Get $get) => (int) $get('rating') <= 2),
Testing. Since this is a Livewire/Filament component, assert state rather than pixels:
livewire(CreateReview::class)
->fillForm(['rating' => 4])
->call('create')
->assertHasNoFormErrors();
$this->assertDatabaseHas('reviews', ['rating' => 4]);
composer.json constraints before upgrading Filament, and run your test suite after any minor Filament bump. Mixing v2/v3 component APIs is the most likely breakage.0 or null. If the widget allows zero stars, required() plus min:1 may conflict with what the UI sends. Validate the exact values the component can emit, and make the column nullable if unrated records are legitimate.php artisan filament:assets and clear caches. With a custom Filament theme, verify the package's views/CSS are included in your Vite build and that custom theme compilation doesn't drop vendor styles.->size() or ->color(), grep the vendor source for the actual method name in the version you installed.Rule::in([1,2,3,4,5]) or between rule at the model/request layer.How can I help you explore Laravel packages today?