fof / polls
A Flarum extension that adds polls to your discussions
Fund package maintenance!
Requires
- flarum/core: ^2.0.0
Requires (Dev)
- flarum/phpstan: ^2.0.0
- flarum/testing: ^2.0.0
- 3.0.0-beta.1
- v2.x-dev
- 2.3.3
- 2.3.2
- 2.3.1
- 2.3.0
- 2.3.0-beta.6
- 2.3.0-beta.5
- 2.3.0-beta.4
- 2.3.0-beta.3
- 2.3.0-beta.2
- 2.3.0-beta.1
- 2.3.0-beta.0
- 2.2.15
- 2.2.14
- 2.2.13
- 2.2.12
- 2.2.11
- 2.2.10
- 2.2.9
- 2.2.8
- 2.2.7
- 2.2.6
- 2.2.5
- 2.2.4
- 2.2.3
- 2.2.2
- 2.2.1
- 2.2.0
- 2.2.0-beta.17
- 2.2.0-beta.16
- 2.2.0-beta.15
- 2.2.0-beta.14
- 2.2.0-beta.13
- 2.2.0-beta.12
- 2.2.0-beta.11
- 2.2.0-beta.10
- 2.2.0-beta.9
- 2.2.0-beta.8
- 2.2.0-beta.7
- 2.2.0-beta.6
- 2.2.0-beta.5
- 2.2.0-beta.4
- 2.2.0-beta.3
- 2.2.0-beta.2
- 2.2.0-beta.1
- 2.2.0-alpha.9
- 2.2.0-alpha.8
- 2.2.0-alpha.7
- v2.2-alpha.6
- v2.2-alpha.5
- 2.2.0-alpha.4
- 2.2.0-alpha.3
- 2.2.0-alpha.2
- 2.1.2
- 2.1.1
- 2.1.0
- 2.0.1
- 2.0.0
- 1.x-dev
- 1.4.2
- 1.4.1
- 1.4.0
- 1.3.0
- 1.2.1
- 1.2.0
- 1.1.0
- 1.0.5
- 1.0.4
- 1.0.3
- 1.0.2
- 1.0.1
- 1.0.0
- 0.4.1
- 0.4.0
- 0.3.3
- 0.3.2
- 0.3.1
- 0.3.0
- 0.2.1
- 0.2.0
- 0.1.5
- 0.1.4
- 0.1.3
- 0.1.2
- 0.1.1
- 0.1.0
- dev-gg/feat-draft-support-global-polls
- dev-gg/improve-poll-settings
- dev-ds/split-v2-migrations-further
- dev-cw/image-url-with-dist
- dev-cw/composer-state-fields
- dev-beta13
This package is auto-updated.
Last update: 2026-04-20 16:21:16 UTC
README
A Flarum extension that adds polls to your discussions.
Installation
composer require fof/polls:"*"
Updating
composer update fof/polls php flarum migrate php flarum cache:clear
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
Image Handling
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
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
Configure in the admin panel under the Polls extension settings:
| Setting | Default | Description |
|---|---|---|
| Allow image uploads | Off | Enable the image upload feature |
| Allow option images | Off | Enable images on individual poll options |
| Image width | 250 | Base width in pixels (2x and 3x derived automatically) |
| Image height | 250 | Base height in pixels |
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
External Image URLs (Deprecated in 2.0)
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
isImageUploadshould transition to checkingimageSrcsetpresence instead
For Extension Developers
If your extension integrates with fof/polls images:
isImageUploadfield — Deprecated on bothPollResourceandPollOptionResource. Use the presence ofimageSrcsetto determine if an image has responsive variants.PollImageWillBeResizedevent — Constructor signature updated to includeisAnimatedparameter. Update any listeners.PollImageUploaderservice — New service class for image operations. Use this instead of direct filesystem access for uploading, deleting, or generating srcset strings.- Frontend
<img>tags — Use theimageSrcset()model accessor and pass it as thesrcsetattribute.
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
An extension by FriendsOfFlarum.