PHPackages                             lslsoft/yii2-poll - 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. lslsoft/yii2-poll

ActiveYii2-extension

lslsoft/yii2-poll
=================

A poll widget for yii2

42162[2 issues](https://github.com/lsl-soft/poll/issues)PHP

Since Jan 25Pushed 9y agoCompare

[ Source](https://github.com/lsl-soft/poll)[ Packagist](https://packagist.org/packages/lslsoft/yii2-poll)[ RSS](/packages/lslsoft-yii2-poll/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

### Yii2-poll widget

[](#yii2-poll-widget)

This is simple poll widget for yii2 framework. You can use both single and multiple answer.

([More information: lslsoft.com](http://lslsoft.com/2017/01/22/simple-poll-widget-for-yii2/))

### Installing

[](#installing)

Yii2-poll can be installed using composer. Run following command to download and install yii2-poll:

```
composer require lslsoft/yii2-poll

```

or add this in require section of composer.json of your project

```
"lslsoft/yii2-poll" : "dev-master"

```

### Migrations

[](#migrations)

Migrations are in the folder

```
lslsoft/yii2-poll/migrations/create

```

Files which are responsible for creating tables and relations needed

```
lslsoft/yii2-poll/migrations/create

```

Files which are responsible for inserting some sample data

to apply migrations add in your config file

```
'migrate-lslsoft-create' => [
            'class' => 'yii\console\controllers\MigrateController',
            'migrationPath' => 'vendor/lslsoft/yii2-poll/migrations/create',
            'migrationTable' => 'migration_lslsoft_create',
        ],
```

to run use the command

```
php yii migrate-lslsoft-create
```

for creating tables and relations needed

and for inserting some sample data:

```
'migrate-lslsoft-insert' => [
            'class' => 'yii\console\controllers\MigrateController',
            'migrationPath' => 'vendor/lslsoft/yii2-poll/migrations/insert',
            'migrationTable' => 'migration_lslsoft_insert',
        ],
```

to run use the command

```
php yii migrate-lslsoft-insert
```

\###Internalization

You should add in your config file

'i18n' =&gt; \[ 'translations' =&gt; \[ 'sourceLanguage' =&gt; 'en-En',

```
            'polls*' => [
                'class' => 'yii\i18n\PhpMessageSource',
                'basePath' => '@yii/vendor/lslsoft/poll/messages',
            ],

        ],
    ],

```

Basic language for extension - english In the folder *lslsoft/yii2-poll/migrations/messages*you will find folder for russian and chinese

\###Usage

```
use lslsoft\poll\Poll;

```

Without any parameter will choose a first poll for which

```
date_beg < today < date_end;

```

```

```

will use poll from table polls with id=1;

On default results will be shown as simple bar chart

```
