2017 © Pedro Peláez
 

yii2-extension yii2-vote

Votes, likes, favorites.

image

hauntd/yii2-vote

Votes, likes, favorites.

  • Friday, June 29, 2018
  • by hauntd
  • Repository
  • 2 Watchers
  • 26 Stars
  • 404 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 9 Forks
  • 2 Open issues
  • 13 Versions
  • 13 % Grown

The README.md

Yii2-Vote Latest Version License Scrutinizer Code Quality Code Climate

This module allows you to attach vote widgets, like/favorite buttons to your models., (*1)

Demo, (*2)

  • Attach as many widgets to model as you need
  • Customization (action, events, views)
  • Useful widgets included (Favorite button, Like button, Rating "up/down")

Installation

The preferred way to install this extension is through composer., (*3)

Either run, (*4)

php composer.phar require --prefer-dist hauntd/yii2-vote "0.3.*"

or add, (*5)

"hauntd/yii2-vote": "*"

to the require section of your composer.json file., (*6)

Configuration

Add module settings to your application config (config/main.php)., (*7)

Entity names should be in camelCase like itemVote, itemVoteGuests, itemLike and itemFavorite., (*8)

return [
  'modules' => [
    'vote' => [
      'class' => hauntd\vote\Module::class,
        'guestTimeLimit' => 3600,
        'entities' => [
          // Entity -> Settings
          'itemVote' => app\models\Item::class, // your model
          'itemVoteGuests' => [
              'modelName' => app\models\Item::class, // your model
              'allowGuests' => true,
              'allowSelfVote' => false,
              'entityAuthorAttribute' => 'user_id',
          ],
          'itemLike' => [
              'modelName' => app\models\Item::class, // your model
              'type' => hauntd\vote\Module::TYPE_TOGGLE, // like/favorite button
          ],
          'itemFavorite' => [
              'modelName' => app\models\Item::class, // your model
              'type' => hauntd\vote\Module::TYPE_TOGGLE, // like/favorite button
          ],
      ],
    ],
  ],
  'components' => [
    ...
  ]
];

After you downloaded and configured hauntd/yii2-vote, the last thing you need to do is updating your database schema by applying the migrations:, (*9)

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

Usage

Vote widget:, (*10)

<?= \hauntd\vote\widgets\Vote::widget([
  'entity' => 'itemVote',
  'model' => $model,
  'options' => ['class' => 'vote vote-visible-buttons']
]); ?>

Like/Favorite widgets:, (*11)

= \hauntd\vote\widgets\Favorite::widget([
    'entity' => 'itemFavorite',
    'model' => $model,
]); ?>

= \hauntd\vote\widgets\Like::widget([
    'entity' => 'itemLike',
    'model' => $model,
]); ?>

Change log

Please see CHANGELOG for more information what has changed recently., (*12)

Documentation

License

BSD 3-Clause License. Please see License File for more information., (*13)

The Versions

29/06 2018

dev-master

9999999-dev

Votes, likes, favorites.

  Sources   Download

BSD-3-Clause

The Requires

 

by Alexander Kononenko

yii2 module votes favorites likes

29/06 2018

0.3.2

0.3.2.0

Votes, likes, favorites.

  Sources   Download

BSD-3-Clause

The Requires

 

by Alexander Kononenko

yii2 module votes favorites likes

23/06 2018

0.3.1

0.3.1.0

Votes, likes, favorites.

  Sources   Download

BSD-3-Clause

The Requires

 

by Alexander Kononenko

yii2 module votes favorites likes

01/11 2017

0.3

0.3.0.0

Votes, likes, favorites.

  Sources   Download

BSD-3-Clause

The Requires

 

by Alexander Kononenko

yii2 module votes favorites likes

23/10 2017

0.2.7

0.2.7.0

Votes, likes, favorites.

  Sources   Download

BSD-3-Clause

The Requires

 

by Alexander Kononenko

yii2 module votes favorites likes

20/09 2017

0.2.6

0.2.6.0

Votes, likes, favorites.

  Sources   Download

BSD-3-Clause

The Requires

 

by Alexander Kononenko

yii2 module votes favorites likes

16/08 2016

0.2.5

0.2.5.0

Votes, likes, favorites.

  Sources   Download

BSD-3-Clause

The Requires

 

by Alexander Kononenko

yii2 module votes favorites likes

09/08 2016

0.2.4

0.2.4.0

Votes, likes, favorites.

  Sources   Download

BSD-3-Clause

The Requires

 

by Alexander Kononenko

yii2 module votes favorites likes

11/07 2016

0.2.3

0.2.3.0

Votes, likes, favorites.

  Sources   Download

BSD-3-Clause

The Requires

 

by Alexander Kononenko

yii2 module votes favorites likes

10/07 2016

0.2.2

0.2.2.0

Votes, likes, favorites.

  Sources   Download

BSD-3-Clause

The Requires

 

by Alexander Kononenko

yii2 module votes favorites likes

08/07 2016

0.2.1

0.2.1.0

Votes, likes, favorites.

  Sources   Download

BSD-3-Clause

The Requires

 

by Alexander Kononenko

yii2 module votes favorites likes

07/07 2016

0.2

0.2.0.0

Votes, likes, favorites.

  Sources   Download

BSD-3-Clause

The Requires

 

by Alexander Kononenko

yii2 module votes favorites likes

02/07 2016

0.1

0.1.0.0

Votes, likes, favorites.

  Sources   Download

BSD-3-Clause

The Requires

 

by Alexander Kononenko

yii2 module votes favorites likes