ianm/online-guests

Display the number of guests browsing your forum

Maintainers

Package info

github.com/imorland/flarum-ext-online-guests-widget

Forum

Type:flarum-extension

pkg:composer/ianm/online-guests

Statistics

Installs: 1 537

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

2.0.0-beta.1 2026-06-09 11:56 UTC

This package is auto-updated.

Last update: 2026-06-09 11:57:09 UTC


README

License Latest Stable Version Total Downloads

A Flarum extension that adds a forum widget showing how many guests (logged-out visitors) are currently browsing your forum.

Screenshot

image

How it works

The widget counts active guest sessions — that is, sessions that are not associated with a logged-in user. The count is determined by inspecting Flarum's session storage, so the supported methods depend on your configured session driver (see Supported session drivers below).

To avoid recalculating on every page load, the result is cached for a configurable period (default: 600 seconds / 10 minutes). The widget is built on top of Forum Widgets Core, which is installed automatically as a dependency and lets admins position, reorder, and toggle widgets from the dashboard.

Supported session drivers

Driver Supported Notes
file The Flarum default. Guest sessions are counted by scanning the session files on disk.
redis Requires fof/redis. Guest session IDs are tracked in a sorted set and counted in real time.
other Any other driver returns a count of 0. Sponsorship of additional drivers (e.g. database) is welcome.

Redis sessions

When you use fof/redis with the Redis session handler, this extension automatically registers a middleware that records the session ID of each guest request in a Redis sorted set, scored by request time. The widget then prunes entries older than the configured Online duration and counts what remains — no disk scanning required.

fof/redis is listed as a Composer suggest, so it is not installed by default. To enable Redis support, install and configure it separately:

composer require fof/redis:"*"

Then enable Redis sessions in the FoF Redis extension settings. No further configuration is needed in this extension — it detects the active session handler automatically.

Settings & permissions

From the admin dashboard you can configure:

  • Online duration — how recently a session must have been active (in minutes) to count as "online". Default: 5.
  • Cache duration — how long (in seconds) the calculated guest count is cached before being recalculated. Default: 600.

A View online guests permission controls which groups can see the widget. Only actors with this permission receive the guest count.

Installation

Install with composer:

composer require ianm/online-guests:"*"

This will also install Forum Widgets Core, which the widget relies on.

Updating

composer update ianm/online-guests:"*"
php flarum migrate
php flarum cache:clear

Links