Giter Site home page Giter Site logo

yii2-vote's Introduction

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 :)

yii2-vote's People

Contributors

chiliec avatar teranchristian avatar skatox avatar yurkinx avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.