yii2-vote

Provides voting for any model :+1: :-1:

Github星跟踪图

Vote for Yii2

Latest Stable Version
Total Downloads
Build Status
Code Climate
Test Coverage
License

How yii2-vote works

Installation

Next steps will guide you through the process of installing yii2-vote using composer. Installation is a quick and easy three-step process.

Step 1: Install component via composer

Run command

php composer.phar require --prefer-dist chiliec/yii2-vote "^4.2"

or add

"chiliec/yii2-vote": "^4.2"

to the require section of your composer.json file.

Step 2: Configuring your application

Add following lines to your main configuration file:

'bootstrap' => [
    'chiliec\vote\components\VoteBootstrap',
],
'modules' => [
    'vote' => [
        'class' => 'chiliec\vote\Module',
        // show messages in popover
        'popOverEnabled' => true,
        // global values for all models
        // 'allowGuests' => true,
        // 'allowChangeVote' => true,
        'models' => [
        	// example declaration of models
            // \common\models\Post::className(),
            // 'backend\models\Post',
            // 2 => 'frontend\models\Story',
            // 3 => [
            //     'modelName' => \backend\models\Mail::className(),
            //     you can rewrite global values for specific model
            //     'allowGuests' => false,
            //     'allowChangeVote' => false,
            // ],
        ],      
    ],
],

And add widget in view:

<?php echo \chiliec\vote\widgets\Vote::widget([
    'model' => $model,
    // optional fields
    // 'showAggregateRating' => true,
]); ?>

Also you can add widget for display top rated models:

<?php echo \chiliec\vote\widgets\TopRated::widget([
    'modelName' => \common\models\Post::className(),
    'title' => 'Top rated models',
    'path' => 'site/view',
    'limit' => 10,
    'titleField' => 'title',
]) ?>

Step 3: Updating database schema

After you downloaded and configured Yii2-vote, the last thing you need to do is updating your database schema by applying the migrations:

$ php yii migrate/up --migrationPath=@vendor/chiliec/yii2-vote/migrations

Documentation

Extended information about configuration of this module see in docs/README.md. There you can find:

List of contributors

Other vote solutions for Yii2

Articles and tutorials

Usage examples

  • Your site could be the first in this list

License

yii2-vote is released under the BSD 3-Clause License. See the bundled LICENSE.md for details.

How to contribute

See CONTRIBUTING.md for details.

Enjoy and don't hesitate to send issues and pull requests :)

主要指标

概览
名称与所有者chiliec/yii2-vote
主编程语言PHP
编程语言PHP (语言数: 1)
平台
许可证BSD 3-Clause "New" or "Revised" License
所有者活动
创建于2015-01-02 11:24:58
推送于2018-06-10 08:34:03
最后一次提交2018-06-10 13:34:02
发布数14
最新版本名称4.2 (发布于 )
第一版名称1.0 (发布于 )
用户参与
星数70
关注者数9
派生数30
提交数93
已启用问题?
问题数26
打开的问题数5
拉请求数8
打开的拉请求数0
关闭的拉请求数1
项目设置
已启用Wiki?
已存档?
是复刻?
已锁定?
是镜像?
是私有?