Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Filament Rating Star Laravel Package

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.

Deep Wiki
Context7

Getting Started

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:

  1. The package README for the current method names.
  2. 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.
  3. Any published config file (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.

Implementation Patterns

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]);

Gotchas and Tips

  • Pin the Filament version. This package is small and last released in September 2024; it targets Filament v3. Check the 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.
  • Zero vs null is a real decision. Decide whether "no rating" is 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.
  • Sorting uses the database value. A star column looks sortable but sorts by the stored integer; it will not sort by a computed average unless you sort on a selected aggregate alias.
  • Assets and styling. If stars render unstyled, run 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.
  • Dark mode and colors. Star fill/empty colors are typically configurable on the component or via config. Test both light and dark mode; hard-coded hex colors often look wrong in dark panels.
  • Don't trust undocumented methods. The public API is thin and the README may lag the code. Before relying on a method like ->size() or ->color(), grep the vendor source for the actual method name in the version you installed.
  • Use model-level validation as a backstop. Anything submitted outside the Filament form (API, imports, seeders) bypasses the widget. Add a Rule::in([1,2,3,4,5]) or between rule at the model/request layer.
  • Accessibility. Star widgets are click targets; check keyboard focus and screen-reader labels in your panel, and provide a visible numeric label or tooltip if the rating is business-critical.
  • Avoid using it for non-rating data. It is a display/input convenience, not a charting tool. For distributions ("5★: 12, 4★: 8"), render your own breakdown instead of stacking many star columns.
  • Extension point. If you need custom behavior, extend the package's field/column classes or wrap them in your own app-level components, so you have one place to adjust when the package is upgraded or abandoned.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
middlewares/firewall
qubiqx/montapacking
nyoncode/laravel-package-console
pnscripts/filament-broadquill-lite
pnscripts/laravel-sentfold-lite
vleap/mx-sdk-laravel-internal
twidpay/utils
htetmyathlaing/scout-elasticsearch-driver
artisan-toolbox/front-awesome
ls/client-assistant
users-au/laravel-client
cgv/localized-resource
noith/settings
kda/laravel-package
kda/filament-dynamic-navigation
bypersoft/signbox
pairus/product-data
fayne/laravel-filament-cms-core
nodisrupt/laravel-agent
sierratecnologia/media-manager