PHPackages                             dsergey/yii2-vote - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. dsergey/yii2-vote

ActiveYii2-extension

dsergey/yii2-vote
=================

Provides anonymous voting for any models

3.0.1(10y ago)018BSD-3-ClausePHP

Since Jan 2Pushed 9y ago1 watchersCompare

[ Source](https://github.com/dsergey/yii2-vote)[ Packagist](https://packagist.org/packages/dsergey/yii2-vote)[ RSS](/packages/dsergey-yii2-vote/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (2)Versions (12)Used By (0)

Vote for Yii2
=============

[](#vote-for-yii2)

[![Latest Stable Version](https://camo.githubusercontent.com/f00aba6d53fa36cc88c1295ce98db4afe9c85f143d685572da91416df808b998/68747470733a2f2f706f7365722e707567782e6f72672f6368696c6965632f796969322d766f74652f762f737461626c652e737667)](https://packagist.org/packages/chiliec/yii2-vote) [![Total Downloads](https://camo.githubusercontent.com/1c825945c498645f59a3ed76bbb494f85fcab1e4f09b3a925603e49b085e0658/68747470733a2f2f706f7365722e707567782e6f72672f6368696c6965632f796969322d766f74652f646f776e6c6f6164732e737667)](https://packagist.org/packages/chiliec/yii2-vote) [![Build Status](https://camo.githubusercontent.com/494ccca0e1d4ada2b8301b43abdbcc2d066a42d0bf17a1f7c290db90ef99cfbe/68747470733a2f2f7472617669732d63692e6f72672f4368696c6965632f796969322d766f74652e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/Chiliec/yii2-vote) [![Test Coverage](https://camo.githubusercontent.com/572b90d24c848d28ef03541744c36266e2dc7185123f4f95d8da728c783a7601/68747470733a2f2f636f6465636c696d6174652e636f6d2f6769746875622f4368696c6965632f796969322d766f74652f6261646765732f636f7665726167652e737667)](https://codeclimate.com/github/Chiliec/yii2-vote/coverage) [![Code Climate](https://camo.githubusercontent.com/ddc7a51d822cecc223445e32d619e1e8c5a33fdf3831538f2a17b2f3ed18fadc/68747470733a2f2f636f6465636c696d6174652e636f6d2f6769746875622f4368696c6965632f796969322d766f74652f6261646765732f6770612e737667)](https://codeclimate.com/github/Chiliec/yii2-vote) [![License](https://camo.githubusercontent.com/d1d4d9565aeae166e47ca13fed72ef93b377ed133c46f157494bfbbe5f85f972/68747470733a2f2f706f7365722e707567782e6f72672f6368696c6965632f796969322d766f74652f6c6963656e73652e737667)](https://packagist.org/packages/chiliec/yii2-vote)

[![How yii2-vote works](https://raw.githubusercontent.com/Chiliec/yii2-vote/master/docs/showcase.gif)](https://raw.githubusercontent.com/Chiliec/yii2-vote/master/docs/showcase.gif)

Installation
------------

[](#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

[](#step-1-install-component-via-composer)

Run command

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

```

or add

```
"chiliec/yii2-vote": "^3.0"

```

to the require section of your `composer.json` file.

### Step 2: Configuring your application

[](#step-2-configuring-your-application)

Add following lines to your main configuration file:

```
'bootstrap' => [
    'chiliec\vote\components\VoteBootstrap',
],
'modules' => [
    'vote' => [
        'class' => 'chiliec\vote\Module',
        // 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:

```

```

Also you can add widget for display top rated models:

```
