PHPackages                             zakharov-andrew/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. [Utility &amp; Helpers](/categories/utility)
4. /
5. zakharov-andrew/yii2-poll

ActiveYii2-extension[Utility &amp; Helpers](/categories/utility)

zakharov-andrew/yii2-poll
=========================

Yii2 module for polls with advanced features: conditional questions, categories, priorities, roles and statuses based access

v0.1(3d ago)11↑2900%MITPHP &gt;=7.4

Since Jul 5Compare

[ Source](https://github.com/ZakharovAndrew/yii2-poll)[ Packagist](https://packagist.org/packages/zakharov-andrew/yii2-poll)[ RSS](/packages/zakharov-andrew-yii2-poll/feed)WikiDiscussions Synced today

READMEChangelog (1)DependenciesVersions (2)Used By (0)

Yii2 Poll
=========

[](#yii2-poll)

[![Latest Stable Version](https://camo.githubusercontent.com/9da5c243a3ffb938f9515b4009f6af5b8f34e57d4189f48e6198d2a7997afc82/68747470733a2f2f706f7365722e707567782e6f72672f7a616b6861726f762d616e647265772f796969322d706f6c6c2f762f737461626c65)](https://packagist.org/packages/zakharov-andrew/yii2-poll)[![Total Downloads](https://camo.githubusercontent.com/f03a35369e5b01ad579f58e9d655ea2b0c9e2251366f65fd820d9a9433790f7a/68747470733a2f2f706f7365722e707567782e6f72672f7a616b6861726f762d616e647265772f796969322d706f6c6c2f646f776e6c6f616473)](https://packagist.org/packages/zakharov-andrew/yii2-poll)[![License](https://camo.githubusercontent.com/387209e3ab42fbbe6ef61e248c03b88e7479a37de487f810ad0baad6ac3349f4/68747470733a2f2f706f7365722e707567782e6f72672f7a616b6861726f762d616e647265772f796969322d706f6c6c2f6c6963656e7365)](https://packagist.org/packages/zakharov-andrew/yii2-poll)[![Yii2](https://camo.githubusercontent.com/d6b0929173e28cc627430d2519ca1853466a70f37395877eaf4820cb3e1e1909/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f506f77657265645f62792d5969695f4672616d65776f726b2d677265656e2e7376673f7374796c653d666c6174)](http://www.yiiframework.com/)

Yii2 module for polls with advanced features: conditional questions, categories, priorities, role/status-based access control, AJAX voting, and customizable appearance.

🚀 Installation
--------------

[](#-installation)

The preferred way to install this extension is through [composer](http://getcomposer.org/download/).

Either run

```
$ composer require zakharov-andrew/yii2-poll

```

or add

```
"zakharov-andrew/yii2-poll": "*"

```

to the `require` section of your `composer.json` file.

Subsequently, run

```
./yii migrate/up --migrationPath=@vendor/zakharov-andrew/yii2-poll/migrations

```

in order to create the settings table in your database.

Or add to console config

```
return [
    // ...
    'controllerMap' => [
        // ...
        'migrate' => [
            'class' => 'yii\console\controllers\MigrateController',
            'migrationPath' => [
                '@console/migrations', // Default migration folder
                '@vendor/zakharov-andrew/yii2-poll/src/migrations'
            ]
        ]
        // ...
    ]
    // ...
];
```

⚙️ Configuration
----------------

[](#️-configuration)

The module automatically registers itself via the Bootstrap class, so you don't need to add it to the `modules` section unless you want to override default settings.

To customize the module, add it to your `config/web.php`:

```
'modules' => [
    'poll' => [
        'class' => 'ZakharovAndrew\poll\Module',
        'defaultRotationStrategy' => 'priority', // 'priority', 'random', 'smart'
        'showCategoryInfo' => true,
        'enableLogging' => YII_DEBUG,
        'cacheConfig' => [
            'duration' => 3600,
        ],
        'defaultWidgetConfig' => [
            // ... see default settings in Module.php
        ],
    ],
],
```

🛠 Usage
-------

[](#-usage)

### Basic Widget

[](#basic-widget)

Simply place the widget anywhere in your view:

```

```

### Widget with Options

[](#widget-with-options)

```

```

### AJAX Voting

[](#ajax-voting)

Voting is handled via AJAX by default – no page reload required. The widget automatically includes the necessary JavaScript.

🌟 Features
----------

[](#-features)

- One poll per widget – clean, focused user experience.
- Multiple polls – automatic rotation between polls.
- Up to 4 answers per poll (configurable).
- Image support – attach an image to the question, placed before or after.
- Date range – set start\_date and end\_date; polls are active only within that period (unlimited if not set).
- Status-based access – allow or deny access based on user status (active, blocked, guest, etc.) using JSON fields allowed\_statuses and denied\_statuses.
- Role-based access – integrate with zakharov-andrew/yii2-user to restrict polls to specific roles.
- Conditional questions – show follow-up questions based on previous answers.
- Categories – organize polls into groups with icons and colors.
- Priority – assign numeric priority (higher = more important) to control display order.
- Rotation strategies:
- - `priority` – sorted by priority descending.
- - `random` – random selection.
- - `smart` – priority + votes count (fewer votes = higher priority).
- Customizable appearance – background color/image, question styles, answer colors, result bar styles, container styling.
- AJAX voting – seamless user experience.
- Statistics – view vote counts and percentages.
- Unique vote protection – prevents multiple votes per user (by user\_id, ip\_address, or session\_id).
- Snooze – users can postpone a poll (optional, can be implemented).
- Progress indicator – shows how many polls are completed (optional).

👥 Contributing
--------------

[](#-contributing)

Contributions are welcome! Please feel free to submit a Pull Request.

1. Fork the repository
2. Create your feature branch (`git checkout -b feature/amazing-feature`)
3. Commit your changes (`git commit -m 'Add some amazing feature'`)
4. Push to the branch (`git push origin feature/amazing-feature`)
5. Open a Pull Request

📄 License
---------

[](#-license)

**yii2-poll** it is available under a MIT License. Detailed information can be found in the `LICENSE.md`.

###  Health Score

33

—

LowBetter than 72% of packages

Maintenance99

Actively maintained with recent releases

Popularity4

Limited adoption so far

Community2

Small or concentrated contributor base

Maturity23

Early-stage or recently created project

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

3d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/08ab00e707ea2dd0f8703587f1b770398b9662c98da6738d7a5e14c13caa1a8a?d=identicon)[ZakharovAndrew](/maintainers/ZakharovAndrew)

---

Tags

yii2modulewidgetpollsurveyyii2 widget

### Embed Badge

![Health badge](/badges/zakharov-andrew-yii2-poll/health.svg)

```
[![Health](https://phpackages.com/badges/zakharov-andrew-yii2-poll/health.svg)](https://phpackages.com/packages/zakharov-andrew-yii2-poll)
```

###  Alternatives

[hiqdev/yii2-language

Yii2 module for language switching

1126.5k1](/packages/hiqdev-yii2-language)[richardfan1126/yii2-js-register

Yii2 widget to register JS into view

1359.3k7](/packages/richardfan1126-yii2-js-register)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
