davidjeddy/yii2-poll

Widget to create custom polls for Yii 2.x framework.

2.0.15 2017-12-11 02:17 UTC

This package is auto-updated.

Last update: 2024-04-05 17:27:24 UTC


README

Badges

SensioLabsInsight Latest Stable Version Total Downloads Latest Unstable Version License Monthly Downloads Daily Downloads

About

Create a basic custom polls for Yii 2.x.

Installing

  • Run composer require davidjeddy/yii2-poll on the terminal in your {project root}
    • OR add "davidjeddy/yii2-poll": "~2" to your projects composer.json in the "required": [...] section then run composer update.
  • Run migration via Yii's migration command providing php ./console/yii migrate/up --migrationPath=./vendor/davidjeddy/yii2-poll/migrations

Usage

Basic:

    echo \davidjeddy\poll\PollWidget::widget([
        'questionText'  => \Yii::t('poll', 'Do you like PHP?'),
        'answerOptions' => ['Yes', 'No'],
    ]);

Advanced:

    echo \davidjeddy\poll\PollWidget::widget([
        'questionText'  => \Yii::t('poll', 'Do you like PHP?'),
        'answerOptions' => ['Yes', 'No'],
        'params'        => [
            'backgroundLinesColor' => '#DCDCDC',// html hex
            'linesColor'           => '#DC0079' // html hex
            'linesHeight'          => 20,       // in pixels
            'maxLineWidth'         => 200,      // in pixels
        ]
    ]);