Download the PHP package asignua/filament-rating without Composer

On this page you can find all versions of the php package asignua/filament-rating. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package filament-rating

Filament Rating

Stand With Ukraine

Filament Rating

Tests

Star ratings for Filament 5: a form field, a table column and an infolist entry that look the same everywhere. Half stars, a "no stars" choice, custom icons (hearts, thumbs, anything from Blade Icons), per-value tooltips, an optional "4.5" next to the stars. The field is a real slider for the keyboard and for screen readers ("3 of 5 stars"), mirrors in RTL and follows the panel colours and dark mode. It is the successor of mokhosh/filament-rating, which stopped before Filament 5, with the same class and method names so you migrate by swapping a namespace.

No JavaScript to build and no Tailwind safelist: the interaction is a few lines of inline Alpine, the stylesheet is namespaced (.fi-rating*) and uses Filament's own colour variables. Free (MIT), there is no Pro edition.

Screenshots

A form with whole stars, half stars and a 10-heart score:

Rating fields in a form

The same ratings in a table (compact) and in an infolist:

Rating column in a table

Rating entries in an infolist

Dark mode follows the panel:

The form in dark mode

Requirements

Installation

php artisan filament-rating:install does the second step too. The plugin class is optional (the field, column and entry work without it); register it if you prefer to list your plugins on the panel:

Usage

The field stores a whole number (4). Store it in an integer column. With half stars it stores 3.5, so use a decimal(2,1) or float column; an empty field is null.

Options

Every option is available on the field, the column and the entry (and takes a value or a closure), except where noted.

Method What it does Default
stars(int $n) Number of stars 5
halfStars() / theme(RatingTheme::HalfStars) Half steps (3.5) whole stars
allowZero() A "no stars" button that stores 0 off
clearable() (field) Clicking the current value (or pressing Delete) empties the field to null off
color('success') A Filament colour name that is registered on the panel (primary, danger, success, ... or your own via FilamentColor) or a palette (Color::Amber) primary
size('lg') xs, sm, md, lg, xl md (sm in tables)
icon('heroicon-s-heart') Filled star icon, any Blade icon heroicon-s-star
emptyIcon('heroicon-o-heart') Empty star icon the filled icon, muted
tooltips([...]) Text per value, see below none
showValue() Print the number ("4.5") after the stars off
disabled() / readOnly() (field) Not operable, not focusable. A readOnly() value is also never saved: it is left out of the form state on the server, so a crafted request cannot change it (the stored value stays as it was). off

The field is a normal Filament field, so required(), label(), live(), default(), helperText(), hint() and the rest work as usual. It validates that the value is numeric, between the minimum and the number of stars, and on the step (no 2.3 on half stars). The minimum is one step: 1 on whole stars, 0.5 on half stars, or 0 with allowZero(). Blank text counts as empty (null), anything that is not a number is rejected.

Tooltips

The text shows as a tooltip while hovering that value and is added to the spoken label ("3 of 5 stars - Good").

Columns and entries

Columns are compact (sm) by default. The stars are rounded to the step of the theme (4.3 shows as 4.5 stars on half stars, 4 on whole stars) and showValue() prints the stored number as it is (one decimal, not clamped to the number of stars). A record without a rating shows empty stars labelled "No rating". Sorting and searching are Filament's own (->sortable()).

Custom icons

Accessibility

Migrating from mokhosh/filament-rating

Then replace the namespace: Mokhosh\FilamentRating\ becomes Asignua\FilamentRating\ (Components\Rating, Columns\RatingColumn, Entries\RatingEntry, RatingTheme keep their names and places).

mokhosh Here
Rating::make(), RatingColumn::make(), RatingEntry::make() Same
stars(int), allowZero() Same
color('primary' ...), size('xs' ... 'xl') size() is the same. color() takes the panel's registered colours: mokhosh's color('amber') worked through Tailwind's text-amber-500 class, here an unregistered name falls back to primary, so register the colour or pass Color::Amber
theme(RatingTheme::Simple / HalfStars) Same (plus the shorthand halfStars())
getStars(), getStarsArray(), shouldAllowZero(), getColor(), getSize(), getTheme() Same
filament-rating:install Same (runs filament:assets)
Published views filament-rating::simple.*, half-stars.*, wrappers.* Differ: the views are field, column, entry; re-do any published and edited copy
Tailwind classes in the views (text-primary-500, ...) Differ: the plugin ships its own .fi-rating* CSS, so nothing needs compiling in your theme
Public property $color / $size Differ: use the getters
Stars are radio inputs Differ: a single slider (keyboard, aria-valuetext)
(not available) New: clearable(), icon(), emptyIcon(), tooltips(), showValue(), readOnly(), validation of range and step, a compact column

The stored values are the same (an int, or 3.5 on half stars), so no data migration is needed.

Translations

The interface ships in English, Ukrainian, German, Spanish, French, Italian, Dutch, Polish, Brazilian Portuguese and Turkish under the filament-rating::filament-rating namespace. A test keeps every language in step with the English keys. Override a string by publishing the translations (--tag=filament-rating-translations) and editing the copy in lang/vendor/filament-rating.

AI agents

The package ships Laravel Boost guidelines (resources/boost/guidelines/core.blade.php) so a coding agent wires it up correctly.

Testing

Try it by hand with the workbench (a Reviews resource with a field, a column and an infolist):

Open /admin/reviews and log in as [email protected] / password.

Changelog

See CHANGELOG.md.

License

The MIT License (MIT). See LICENSE.md.


All versions of filament-rating with dependencies

PHP Build Version
Package Version
Requires php Version ^8.3
filament/filament Version ^5.0
illuminate/contracts Version ^12.0|^13.0
spatie/laravel-package-tools Version ^1.16
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package asignua/filament-rating contains the following files

Loading the files please wait ...