Search by

ernestdefoe / giveaways

ernestdefoe

Run provably-fair giveaways and raffles on your Flarum 2 forum β€” earn-entries engine, scheduled auto-draws, winner notifications.

Package info

github.com/ernestdefoe/giveaways

Forum

Type:flarum-extension

pkg:composer/ernestdefoe/giveaways

Fund package maintenance!

Buy Me A Coffee

Statistics

Installs: 202

Dependents: 0

Suggesters: 0

Stars: 1

Open Issues: 0

v0.7.0 2026-10-19 16:31 UTC

This package is auto-updated.

Last update: 2026-10-19 16:55:32 UTC


README

License: MIT Latest Stable Version

Run provably-fair giveaways on your Flarum community. Members enter with one click, earn bonus entries for being active, and winners are drawn automatically β€” with a published seed and entrant fingerprint anyone can verify.

status

Giveaways page

Features

  • 🎁 Beautiful giveaways page β€” a dedicated /giveaways page with cards, live countdowns, status badges and entrant counts.
  • 🎟️ One-click entry β€” registered members enter instantly. The button shows their current entry count.
  • ⭐ Earn-entries engine β€” grant a one-time bonus when entrants post in the community, rewarding real activity.
  • πŸ—‚οΈ Categories β€” organise giveaways into colour-coded categories with filter pills, badges and an inline manager.
  • 🎯 Eligibility rules β€” optionally require a minimum post count or account age to enter.
  • πŸ“œ Official rules β€” publish the full terms (eligibility, how winners are selected, deadlines, odds, sponsor) in their own section on the giveaway page, separate from the short description, for communities whose local law requires them.
  • βž— Skill-testing question β€” optionally require the drawn winner to answer a question correctly before the prize is awarded, for jurisdictions (Canada among them) where a pure game of chance would be an illegal lottery. Entering stays one click; the question is put to the winner at claim time. Optionally set how many wrong answers are allowed before the winner forfeits and the prize is redrawn β€” the replacement is the next entrant the same published seed picks, so the result stays verifiable. Answer checking ignores case, spaces and thousands separators, and compares numeric answers as numbers.
  • ⏱️ Scheduled auto-draw β€” set an end time and the winners are drawn automatically by the scheduler. Hosts can also draw now at any time.
  • πŸ”” Winner notifications β€” every winner gets an in-app alert linking straight to the giveaway.
  • πŸ“¦ Prize claiming β€” winners get a "You won!" banner with a one-click Claim button; the host is notified and can see per-winner claim status, plus optional claim instructions (e.g. "DM me your address").
  • πŸ›‘οΈ Provably fair β€” every draw publishes a random seed and a SHA-256 hash of the full entrant list, so the result is independently reproducible and tamper-evident.
  • πŸ† Multiple winners β€” draw any number of weighted winners in a single fair pass.
  • 🧩 Giveaway cards in posts β€” paste a giveaway's link on a line of its own and the post shows the giveaway's card. Every link on a page is looked up in one request, and a link to a giveaway that no longer exists stays a plain link. Works with flarum/markdown and with Scribe.
  • πŸ–ΌοΈ Cover from your media library β€” with fof/upload enabled, the cover image field gets a Media library button: pick an image you uploaded before, or upload a new one, in fof/upload's own media manager.
  • ✍️ Add a giveaway from the composer β€” an Add giveaway button in the discussion and reply composers. The giveaway is saved as a draft only you can see, its link goes into your post, and it goes public when the post is posted (or approved, with flarum/approval). Saving the post as a fof/drafts draft β€” or scheduling it β€” keeps the giveaway a draft until the post goes up.
  • πŸ“ Drafts β€” save any giveaway as a draft and publish it when ready. The list page has All / Open / Ended / Drafts tabs; Drafts only shows for members who have some.
  • πŸ—“οΈ Start and draw times β€” the giveaway page shows when it starts (if set) and when it is drawn; before the start it reads "Starts in…" and entry opens on time.
  • 🎫 One prize per winner β€” list one prize per line (gift codes, keys…): winner #1 gets line 1, winner #2 line 2, and so on. Each winner sees only their own line, and only after claiming. The winner count shows next to the prize (Γ— 10).
  • πŸ‘₯ Participants list β€” the host, managers and anyone with View giveaway participants can see who entered and when, a page at a time.
  • πŸ–‹οΈ Formatted descriptions and rules β€” written in the forum's own editor and rendered by Flarum's formatter, exactly like a post: links, lists, bold and italic, safely.
  • πŸ” Granular permissions β€” separate enter, create own, view participants and manage all permissions.

Screenshots

Giveaway page β€” enter, requirements & live countdown

Giveaway detail

Provably-fair results β€” published winners, seed & entrant hash

Drawn giveaway with winners and fairness data

Installation

composer require ernestdefoe/giveaways

Then enable Giveaways in your admin panel and review the permissions grid.

Scheduled draws require Flarum's scheduler to be running. Add this to your server's crontab:

* * * * * cd /path/to/flarum && php flarum schedule:run >> /dev/null 2>&1

Without it, giveaways won't auto-draw at their end time β€” but you can still draw manually from each giveaway page.

Updating

composer update ernestdefoe/giveaways
php flarum migrate
php flarum cache:clear

How the fair draw works

When a giveaway is drawn:

  1. The full entrant list is serialized in a fixed order (userId:entries, sorted by user id) and hashed with SHA-256 β€” this is the entrant hash.
  2. A random seed is generated.
  3. For each winner slot i, the winner is chosen by SHA-256(seed:i) reduced over the weighted entry pool, removing each winner before the next pick.

Because the seed and entrant hash are published on the giveaway page, anyone can re-run the algorithm and confirm the winners were not manipulated.

Permissions

Permission Default Description
giveaways.enter Members Enter giveaways
giveaways.create Admins Create and manage own giveaways
giveaways.viewParticipants Moderators See who entered a giveaway, and when (a host always sees their own)
giveaways.manage Admins Manage all giveaways

Settings

  • Show a "Giveaways" link in the main navigation β€” toggle the nav item.
  • Navigation label β€” customise the link text.

Support

License

MIT Β© ernestdefoe