PHPackages                             fof/polls - 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. fof/polls

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

fof/polls
=========

 A Flarum extension that adds polls to your discussions

2.3.4(1mo ago)25133.5k↓44.6%17[9 issues](https://github.com/FriendsOfFlarum/polls/issues)[4 PRs](https://github.com/FriendsOfFlarum/polls/pulls)8MITPHPCI passing

Since Jul 3Pushed 1mo ago3 watchersCompare

[ Source](https://github.com/FriendsOfFlarum/polls)[ Packagist](https://packagist.org/packages/fof/polls)[ Docs](https://friendsofflarum.org)[ Fund](https://opencollective.com/fof/donate)[ RSS](/packages/fof-polls/feed)WikiDiscussions 2.x Synced 2d ago

READMEChangelog (10)Dependencies (6)Versions (102)Used By (8)

Polls by FriendsOfFlarum
========================

[](#polls-by-friendsofflarum)

[![License](https://camo.githubusercontent.com/7013272bd27ece47364536a221edb554cd69683b68a46fc0ee96881174c4214c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c75652e737667)](https://camo.githubusercontent.com/7013272bd27ece47364536a221edb554cd69683b68a46fc0ee96881174c4214c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c75652e737667) [![Latest Stable Version](https://camo.githubusercontent.com/c09c417452e2c87c99c0a11442698b486c6f1440b07ac900ab98c160390d2a6c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f666f662f706f6c6c732e737667)](https://packagist.org/packages/fof/polls) [![OpenCollective](https://camo.githubusercontent.com/1903c197bb0307e60d6328653532b8a6b9890b898fbc92e314ab39d699491e74/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6f70656e636f6c6c6563746976652d666f662d626c75652e737667)](https://opencollective.com/fof/donate)

A [Flarum](https://flarum.org) extension that adds polls to your discussions.

Installation
------------

[](#installation)

```
composer require fof/polls:"*"
```

Updating
--------

[](#updating)

```
composer update fof/polls
php flarum migrate
php flarum cache:clear
```

Features
--------

[](#features)

- Create polls in discussions or as standalone global polls
- Single and multiple choice voting
- Public/private vote visibility
- Poll end dates
- Poll images with WebP conversion and HiDPI (srcset) support
- Poll option images
- Poll groups for organizing global polls
- Granular permissions for poll creation, voting, and moderation

Global Polls
------------

[](#global-polls)

### What Are Global Polls?

[](#what-are-global-polls)

Global polls are polls that exist on their own, independent of any discussion. Instead of being attached to a post, they appear on a dedicated **Polls** page accessible from the main navigation, where members can browse and vote on them as standalone items.

### What Can You Use Global Polls For?

[](#what-can-you-use-global-polls-for)

- **Community-wide votes:** feature requests, governance decisions, or general-interest questions that shouldn't be buried inside a thread.
- **Announcements &amp; surveys:** recurring satisfaction surveys, event planning, or quick "pulse" polls.
- **Long-running questions:** polls with end dates that stay discoverable on the page until they close.

### Enabling Global Polls

[](#enabling-global-polls)

1. In the admin panel, open the **Polls** extension settings and enable **Allow global polls**.
2. Grant the **Start a global poll** permission (`startGlobalPoll`) to the groups you want to be able to create global polls.
3. A **Polls** link appears in the forum navigation, pointing at the page of published global polls.

### How to Use

[](#how-to-use)

1. **Create a global poll:**Navigate to the Polls page and click **New poll**. Fill in the question, options, and any optional settings (end date, image, multiple votes, etc.), then publish.
2. **Browse &amp; filter:**The page supports sorting (newest, most voted, ending soon) and a status filter (All / Published / Drafts). Drafts are only visible to their author, moderators, and administrators.
3. **Vote:**Open a poll to cast your vote and see the results.

### Permissions

[](#permissions)

- *Start a global poll (`startGlobalPoll`)*: who can create global polls. In practice this is usually limited to administrators and moderators.
- *Moderate polls (`discussion.polls.moderate`)*: moderators can edit, delete, publish, and unpublish any global poll.

### Drafts &amp; Scheduled Publication

[](#drafts--scheduled-publication)

Global polls can be saved as drafts, published manually, or scheduled to go live at a specific time. This lets you prepare a poll in advance and have it appear on the Polls page automatically when the scheduled moment arrives.

#### How to Use

[](#how-to-use-1)

1. **Create a draft:**On the global poll compose page, click **Save as draft**. The poll is stored with `published_at = NULL` and does not appear on the public Polls page.
2. **Publish manually:**From either the compose page or the poll controls menu, click **Publish** to mark the draft as published immediately.
3. **Schedule publication:**Click the clock icon next to the **Publish** button (or **Schedule publication** in the controls menu) and pick a datetime. The poll stays in draft state until a cron-driven command publishes it.
4. **Cancel a schedule:**Use **Cancel schedule** in the controls menu to clear the scheduled time and keep the poll as a draft.

#### Cron setup (required for scheduled publication)

[](#cron-setup-required-for-scheduled-publication)

Scheduled drafts are published by Flarum's built-in task scheduler. If you don't already run it, open your crontab:

```
crontab -e
```

And add:

```
* * * * * cd /path/to/flarum && php flarum schedule:run
```

A single `schedule:run` entry covers scheduled polls and any other extension that registers scheduled tasks — you don't need a polls-specific line. Our task runs every minute and takes row-level locks, so multiple workers (e.g. an ECS deployment with `N > 1` tasks) won't double-publish the same poll.

If a scheduled draft fails validation at publish time (missing question, fewer than two options, etc.), the error is recorded on the poll and future runs skip it until the author fixes the issue and re-schedules.

Image Handling
--------------

[](#image-handling)

### WebP Conversion &amp; srcset

[](#webp-conversion--srcset)

Uploaded images are automatically converted to WebP format (or preserved as GIF for animated images) and stored with responsive variants:

- **Base (1x)** - sized to admin-configured dimensions (default 250x250)
- **@2x** - double resolution for HiDPI displays
- **@3x** - triple resolution for ultra-high DPI displays

Variants are only generated when the source image is large enough — images are never upscaled.

The API response includes an `imageSrcset` field that browsers use to select the appropriate resolution automatically.

### Converting Existing Images

[](#converting-existing-images)

If you're upgrading from a previous version, existing PNG images can be converted to the new WebP format with srcset variants:

```
php flarum fof:polls:convert-images
```

This is optional — existing PNG images will continue to work without conversion. Add `--cleanup` to remove original PNG files after successful conversion:

```
php flarum fof:polls:convert-images --cleanup
```

### Image Settings

[](#image-settings)

Configure in the admin panel under the Polls extension settings:

SettingDefaultDescriptionAllow image uploadsOffEnable the image upload featureAllow option imagesOffEnable images on individual poll optionsImage width250Base width in pixels (2x and 3x derived automatically)Image height250Base height in pixels### Metadata Refresh

[](#metadata-refresh)

To improve performance, Polls calculates and stores the number of votes when it changes.

If you made manual changes to the database you can refresh the numbers:

```
php flarum fof:polls:refresh
```

Deprecations
------------

[](#deprecations)

### External Image URLs (Deprecated in 2.0)

[](#external-image-urls-deprecated-in-20)

**Will be removed in the next major version.**

Previous versions allowed pasting external image URLs directly. This is now deprecated in favour of the built-in upload system which provides:

- Proper image validation and security checks
- Automatic WebP conversion for better performance
- srcset variants for HiDPI displays
- Consistent storage and CDN support

**What this means:**

- Existing polls with external URL images will continue to display normally
- The URL paste input has been removed from the poll creation form
- When editing an existing poll with a URL image, a deprecation notice is shown encouraging re-upload
- Extensions that relied on `isImageUpload` should transition to checking `imageSrcset` presence instead

### For Extension Developers

[](#for-extension-developers)

If your extension integrates with fof/polls images:

- **`isImageUpload` field** — Deprecated on both `PollResource` and `PollOptionResource`. Use the presence of `imageSrcset` to determine if an image has responsive variants.
- **`PollImageWillBeResized` event** — Constructor signature updated to include `isAnimated` parameter. Update any listeners.
- **`PollImageUploader` service** — New service class for image operations. Use this instead of direct filesystem access for uploading, deleting, or generating srcset strings.
- **Frontend `` tags** — Use the `imageSrcset()` model accessor and pass it as the `srcset` attribute.

Poll Groups
-----------

[](#poll-groups)

Poll Groups allow you to organize multiple polls under a single topic. Enable via the admin setting "Enable poll groups".

**Permissions:**

- *View poll groups* — Controls who can see poll groups
- *Create poll groups* — Controls who can create new poll groups
- *Moderate poll groups* — Allows moderators to edit and delete any poll groups

Links
-----

[](#links)

- [Discuss](https://discuss.flarum.org/d/20586)
- [GitHub](https://github.com/FriendsOfFlarum/polls)
- [Packagist](https://packagist.org/packages/fof/polls)
- [Open Collective](https://opencollective.com/fof/donate)

An extension by [FriendsOfFlarum](https://github.com/FriendsOfFlarum).

###  Health Score

62

—

FairBetter than 99% of packages

Maintenance84

Actively maintained with recent releases

Popularity44

Moderate usage in the ecosystem

Community36

Small or concentrated contributor base

Maturity76

Established project with proven stability

 Bus Factor3

3 contributors hold 50%+ of commits

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

Every ~28 days

Recently: every ~5 days

Total

91

Last Release

43d ago

Major Versions

0.4.1 → 1.0.02021-05-27

1.4.2 → v2.x-dev2023-07-12

2.3.3 → 3.0.0-beta.12026-04-17

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/16573496?v=4)[IanM](/maintainers/imorland)[@imorland](https://github.com/imorland)

![](https://avatars.githubusercontent.com/u/1630413?v=4)[Gregor Hammerschmidt](/maintainers/GreXXL)[@GreXXL](https://github.com/GreXXL)

![](https://www.gravatar.com/avatar/0538135c1debcef5602dce7ece027909cc832b7a6284ab9189a19aa8de98d60d?d=identicon)[clarkwinkelmann](/maintainers/clarkwinkelmann)

![](https://www.gravatar.com/avatar/1298cdc0b2402a1aa34fb75a254947d655e090d62bd0531311331d369cac934e?d=identicon)[datitisev](/maintainers/datitisev)

---

Top Contributors

[![ShahiemS](https://avatars.githubusercontent.com/u/188719889?v=4)](https://github.com/ShahiemS "ShahiemS (68 commits)")[![dsevillamartin](https://avatars.githubusercontent.com/u/6401250?v=4)](https://github.com/dsevillamartin "dsevillamartin (61 commits)")[![flarum-bot](https://avatars.githubusercontent.com/u/39334649?v=4)](https://github.com/flarum-bot "flarum-bot (45 commits)")[![imorland](https://avatars.githubusercontent.com/u/16573496?v=4)](https://github.com/imorland "imorland (27 commits)")[![KyrneDev](https://avatars.githubusercontent.com/u/13856015?v=4)](https://github.com/KyrneDev "KyrneDev (26 commits)")[![clarkwinkelmann](https://avatars.githubusercontent.com/u/5264300?v=4)](https://github.com/clarkwinkelmann "clarkwinkelmann (20 commits)")[![Ralkage](https://avatars.githubusercontent.com/u/2059356?v=4)](https://github.com/Ralkage "Ralkage (13 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (6 commits)")[![DavideIadeluca](https://avatars.githubusercontent.com/u/146922689?v=4)](https://github.com/DavideIadeluca "DavideIadeluca (5 commits)")[![gianniguida](https://avatars.githubusercontent.com/u/53989450?v=4)](https://github.com/gianniguida "gianniguida (4 commits)")[![Ziiven](https://avatars.githubusercontent.com/u/29644610?v=4)](https://github.com/Ziiven "Ziiven (3 commits)")[![davwheat](https://avatars.githubusercontent.com/u/7406822?v=4)](https://github.com/davwheat "davwheat (3 commits)")[![iPurpl3x](https://avatars.githubusercontent.com/u/18526076?v=4)](https://github.com/iPurpl3x "iPurpl3x (3 commits)")[![karaok491](https://avatars.githubusercontent.com/u/72854852?v=4)](https://github.com/karaok491 "karaok491 (3 commits)")[![SAY-5](https://avatars.githubusercontent.com/u/240962040?v=4)](https://github.com/SAY-5 "SAY-5 (2 commits)")[![glombers](https://avatars.githubusercontent.com/u/18645897?v=4)](https://github.com/glombers "glombers (2 commits)")[![rafaucau](https://avatars.githubusercontent.com/u/25438601?v=4)](https://github.com/rafaucau "rafaucau (2 commits)")[![Hiobi](https://avatars.githubusercontent.com/u/2171856?v=4)](https://github.com/Hiobi "Hiobi (1 commits)")[![spaeps](https://avatars.githubusercontent.com/u/1037160?v=4)](https://github.com/spaeps "spaeps (1 commits)")[![StyleCIBot](https://avatars.githubusercontent.com/u/11048387?v=4)](https://github.com/StyleCIBot "StyleCIBot (1 commits)")

---

Tags

flarum

### Embed Badge

![Health badge](/badges/fof-polls/health.svg)

```
[![Health](https://phpackages.com/badges/fof-polls/health.svg)](https://phpackages.com/packages/fof-polls)
```

###  Alternatives

[flarum-lang/russian

Russian language pack for Flarum.

12128.3k](/packages/flarum-lang-russian)[fof/byobu

Well integrated, advanced private discussions.

59120.6k13](/packages/fof-byobu)[fof/discussion-language

Specify the language a discussion is written in &amp; sort by language

1034.8k4](/packages/fof-discussion-language)[flarum-lang/french

French language pack to localize the Flarum forum software plus its official and third-party extensions.

1938.7k](/packages/flarum-lang-french)[fof/gamification

Upvotes and downvotes for your Flarum community

4066.1k8](/packages/fof-gamification)[fof/best-answer

Mark a post as the best answer in a discussion

25154.0k20](/packages/fof-best-answer)

PHPackages © 2026

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