Download the PHP package emleons/sim-rating without Composer

On this page you can find all versions of the php package emleons/sim-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 sim-rating

Sim-Rating - A Simple 5-Star Rating System for PHP

Latest Version Tests Docs License

Documentation: https://emleonstz.github.io/sim-rating/

Sim-Rating is a lightweight,PHP library for displaying and calculating 5-star ratings. It supports multiple display formats (stars, bars, JSON) and is highly customizable and works with any php frame work.

### Default Star Rating --- ### Custom Bar Rating

Features

Installation

Requirements: PHP 8.3+.

Install via Composer:

Basic Implementation

Output Formats

Customization Options

Star Display Options

Bar Display Options

All Configuration Options

Option Type Required Default Description
type string Yes stars stars or bars
color string Yes #ffc107 Main color
size string Yes 1em Display size
show_average bool No true Show average rating
show_total bool No true Show total ratings
show_summary bool Yes false Show summary text
interactive bool Yes false Make ratings clickable
bar_height string No 20px Bar thickness
bar_spacing string No 8px Space between bars
bar_show_percentages bool No true Show percentages

Updating Options

Laravel Blade

Important Tips

  1. Rating keys are optional by default missing buckets count as 0. Enable the strict option if you want to require all five.
  2. Set show_summary based on your display needs
  3. Use interactive only when you need user ratings
  4. For bars, customize heights and spacing to match your design
  5. All color/size values are validated and escaped automatically — invalid values safely fall back to defaults.

Security

sim-rating escapes every value that ends up in the rendered markup, so it is safe to render data that originates from user input. Colour and size options are validated against strict allow-lists and fall back to safe defaults if they do not match.

Common Errors

Styling

Every rendered element carries a stable, namespaced BEM class so you can style it from your own CSS file. This is the recommended way to customize the look it needs no raw-CSS option and carries no injection risk. The legacy sim-rating* classes are still present (deprecated) for backward compatibility.

Class map

Element BEM class Legacy class (deprecated)
Root (every widget) em-sim-rating sim-rating
Stars wrapper em-sim-rating__stars —
Each star em-sim-rating__star sim-rating-star
Average em-sim-rating__average sim-rating-average
Total em-sim-rating__total sim-rating-total
Bars root em-sim-rating__bars sim-rating-bars-container
A bar row em-sim-rating__bar sim-rating-bar
Bar label em-sim-rating__bar-label sim-rating-bar-label
Bar track em-sim-rating__bar-track sim-rating-bar-bg
Bar fill em-sim-rating__bar-fill sim-rating-bar-fill
Bar percent em-sim-rating__bar-percent sim-rating-bar-percent
Summary em-sim-rating__summary sim-rating-summary
SVG root em-sim-rating__svg sim-rating-svg

Option 1 — include the canonical stylesheet

Add the shipped stylesheet once in your layout, then render with inline styles disabled:

Theme it with CSS custom properties on .em-sim-rating:

…or write full rules against the BEM classes:

Option 2 — target a single widget (uniqueness)

Give a widget a stable instance_id; it becomes a data-sim-rating-id attribute and an em-sim-rating--{id} scope class:

Each widget's default inline CSS is scoped to its own id, so multiple widgets on one page never clash.

Note: there is intentionally no raw custom_css option. Passing raw CSS through a value would re-introduce an injection vector. Style via the BEM classes / custom properties above instead.

Display Types

Stars

Bars

SVG

JSON Output

Advanced Usage

Type-safe display types

Per-render options (without mutating the instance)

Strict validation

Using in Frameworks

Laravel:

Symfony:

CodeIgniter 4:

Documentation

Full guides live at https://emleonstz.github.io/sim-rating/.

Preview locally:

Deploys automatically to GitHub Pages via Docs workflow on pushes to main touching docs/**, mkdocs.yml, or requirements-docs.txt.

Testing

Run the full quality gate (code style + static analysis + tests):

Or run the pieces individually:

Contributing

Contributions are welcome! Please read CONTRIBUTING.md for the local setup and quality bar, and SECURITY.md for how to report security vulnerabilities.

Changelog

See CHANGELOG.md for a history of notable changes.

License

MIT License. See LICENSE for more information.


All versions of sim-rating with dependencies

PHP Build Version
Package Version
Requires php Version >=8.3
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 emleons/sim-rating contains the following files

Loading the files please wait ...