simialbi / yii2-interactive-voting
Interactive voting module for yii2
Installs: 116
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 2
Forks: 2
Type:yii2-extension
Requires
- php: >=7.3
- arogachev/yii2-sortable: ^0.1.6
- fortawesome/font-awesome: ^5.12.0
- kartik-v/yii2-grid: ^3.3.0
- kartik-v/yii2-widget-datepicker: ^1.4.7
- kartik-v/yii2-widget-fileinput: ^1.0.9
- kartik-v/yii2-widget-select2: ^2.1.0
- simialbi/yii2-fontawesome: ^3.4.8
- simialbi/yii2-simialbi-base: >=0.13.1 <1.0 | ^1.0.0
- simialbi/yii2-summernote: ^1.2.2
- simialbi/yii2-widget-chart: ^0.7.0 | ~1.0@dev
- simialbi/yii2-widget-hideseek: ^1.0.0
- yiisoft/yii2: ^2.0.20
- yiisoft/yii2-bootstrap4: ^2.0.4
- yiisoft/yii2-httpclient: ^2.0.0
Requires (Dev)
- phpunit/phpunit: <7
- simialbi/yii2-websms-com: ^1.0.0
- yiisoft/yii2-coding-standards: ~2.0
README
(badges)
Resources
Installation
The preferred way to install this extension is through composer.
Either run
$ php composer.phar require --prefer-dist simialbi/yii2-interactive-voting
or add
"simialbi/yii2-interactive-voting": "^1.0.0"
to the require
section of your composer.json
.
Usage
In order to use this module, you will need to:
- Setup Module your application so that the module is available.
- Create a user identity class which extends UserInterface
Setup Module
Configure the module in the modules section of your Yii configuration file.
Create identity
Create an identity class which implements simialbi\yii2\models\UserInterface
e.g.:
<?php use yii\db\ActiveRecord; use simialbi\yii2\models\UserInterface; class User extends ActiveRecord implements UserInterface { /** * {@inheritDoc} */ public static function tableName() { return 'user'; } /** * {@inheritDoc} */ public static function findIdentity($id) { return static::findOne($id); } /** * {@inheritDoc} */ public static function findIdentityByAccessToken($token, $type = null) { return static::findOne(['access_token' => $token]); } /** * {@inheritDoc} */ public function getId() { return $this->id; } /** * {@inheritDoc} */ public function getAuthKey() { return $this->auth_key; } /** * {@inheritDoc} */ public function validateAuthKey($authKey) { return $this->getAuthKey() === $authKey; } /** * {@inheritDoc} */ public function getImage() { return $this->image; } /** * {@inheritDoc} */ public function getName() { return trim($this->first_name . ' ' . $this->last_name); } /** * {@inheritDoc} */ public static function findIdentities() { return static::find()->all(); } }
After creating this class define it as identity class in your application configuration:
'components' => [ 'user' => [ 'identityClass' => 'app\models\User' ] ]
Example Usage
Now you can access the interactive voting module by navigating to /voting
.
License
yii2-interactive-voting is released under MIT license. See bundled LICENSE for details.