Skip to content

A Yii2 widget for the simple star-rating plugin with captions and colors

License

Notifications You must be signed in to change notification settings

zorinpavel/yii2-star-rating

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 

Repository files navigation

A Yii2 widget

GitHub license GitHub Release

A Yii2 widget for the simple star-rating plugin with fractional rating support

How does it work

composer require zorinpavel/yii2-star-rating
<?php

use zorinpavel\StarRating\StarRatingWidget;

echo StarRatingWidget::widget([
    'id' => 'feedback-id',
    // name for the input field
    'name' => 'feedback',
    'value' => false,
    // how many stars do you want
    'stars' => 5,
    // switch off user interaction
    'disabled' => false,
    // input field will be with required attribute
    'required' => true,
    // you can specify captions for each star
    'starCaptions' => [
        0 => 'nothing',
        1 => 'bad',
        2 => 'sad',
        3 => 'ok',
        4 => 'good',
        5 => 'very good',
    ],
]);