PHPackages                             ekumanov/flarum-ext-forum-widgets - 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. ekumanov/flarum-ext-forum-widgets

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

ekumanov/flarum-ext-forum-widgets
=================================

Forum Stats Widget — online users, discussion/post/user counts, and latest registration in a compact sidebar widget for Flarum 2.0

v1.6.1(3w ago)0645MITJavaScriptPHP ^8.2

Since Mar 26Pushed 3w agoCompare

[ Source](https://github.com/ekumanov/flarum-ext-forum-stats-widget)[ Packagist](https://packagist.org/packages/ekumanov/flarum-ext-forum-widgets)[ RSS](/packages/ekumanov-flarum-ext-forum-widgets/feed)WikiDiscussions main Synced 3w ago

READMEChangelogDependencies (3)Versions (23)Used By (0)

Forum Stats Widget for Flarum 2.0
=================================

[](#forum-stats-widget-for-flarum-20)

A compact widget that displays online users, forum statistics (discussions, posts, users), and the latest registration — with configurable layout options for both desktop and mobile.

Screenshots
-----------

[](#screenshots)

Desktop — CollapsedDesktop — Expanded[![Desktop collapsed](screenshots/desktop-inside-toolbar-collapsed.png)](screenshots/desktop-inside-toolbar-collapsed.png)[![Desktop expanded](screenshots/desktop-inside-toolbar-expanded.png)](screenshots/desktop-inside-toolbar-expanded.png)**Mobile — Collapsed****Mobile — Expanded**[![Mobile collapsed](screenshots/mobile-inside-toolbar-collapsed.png)](screenshots/mobile-inside-toolbar-collapsed.png)[![Mobile expanded](screenshots/mobile-inside-toolbar-expanded.png)](screenshots/mobile-inside-toolbar-expanded.png)Features
--------

[](#features)

- **Online Users** — Shows avatars of currently online users, sorted by most recently active. The list is internally capped at 500 — high enough that real-world forums never hit it; if they do, the overflow renders as a "+N more" indicator. Users who have hidden their online status are shown as a separate "hidden" count with a dashed circle.
- **Online Guests** — Optional approximate count of unauthenticated visitors browsing the forum, shown as a separate row with a dotted circle below the hidden users. Each guest tab pings a small endpoint that records a hash of the visitor's IP and User-Agent into a short-lived presence map; the displayed count is the number of unique fingerprints seen within the "last seen interval". Counting is approximate by design — visitors behind a shared NAT collapse into one, mobile users on rotating IPs may be over-counted — and **no persistent identifier is stored on the visitor's browser**. The endpoint is rate-limited per IP, the in-memory map is hard-capped (oldest evicted on overflow), and the count can optionally be merged into the bar's main "online" number.
- **Forum Statistics** — Displays discussion count, post count, and total user count with plural-aware labels.
- **Latest Registration** — Shows the most recently registered user with their avatar and display name.
- **Expandable Panel** — Compact stats bar with a click-to-expand panel for detailed information.
- **Live Updates** — Widget data auto-refreshes when you navigate back to the forum index (SPA navigation) or bring the browser tab back to the foreground. Combined with event-driven server cache invalidation on discussion / post / user events, stats stay fresh on every page return without a full reload. Desktop and mobile widget instances share one in-flight request, and actors without widget permissions skip the refetch entirely.
- **Presence Heartbeat** — Logged-in users with a focused tab send a small background ping every minute so the online indicator stays accurate even while they read or compose a long reply via the realtime extension without navigating. On the forum index the same ping doubles as a widget refresh (sparse fields, ~500 bytes per ping), so the online users list and stats keep themselves current — near-realtime, no navigation needed. Off the index it's a 92-byte sparse ping. Throttled to one DB write per 3 minutes per user, skipped when the tab is hidden or the user is a guest, and disable-able from admin.
- **Configurable Layout** — Choose between a classic sidebar widget or a full-width bar above the discussion list. Full-width mode supports positioning above, inside, or below the toolbar on desktop.
- **Separate Desktop/Mobile Settings** — Independent bar position settings for desktop and mobile views.
- **Stat Toggles** — Each statistic (discussions, posts, users, latest registration) can be individually enabled or disabled from the admin panel.
- **Two-Tier Caching** — Separate caches for privileged users (admins/mods who can see hidden users) and regular users — same display cap, different result sets. Zero database queries on cache hit.
- **Event-Driven Cache Invalidation** — Caches are automatically flushed when discussions, posts, or users are created or deleted.
- **Granular Permissions** — Each stat (online users, discussions, posts, users, latest registration) can be independently permission-gated. All default to visible for guests.
- **Accessible** — ARIA labels and roles throughout, screen-reader-friendly counts (e.g. the guest badge announces as "12,345 guests" rather than relying on the visual dotted-vs-dashed distinction), section headings exposed via `role="heading"` for H-key navigation, full keyboard support (Tab to the toggle, Enter to expand, Tab through the panel, Escape to close and return focus to the toggle), and elastic count badges that gracefully degrade to a pill shape for large numbers without overflowing.
- **Fully Localizable** — Every user-facing string flows through locale keys with ICU plural support; no hardcoded English. Translators can add a language by dropping a YAML file alongside `locale/en.yml`.

Requirements
------------

[](#requirements)

- **Flarum 2.0** (not compatible with Flarum 1.x)
- **PHP 8.2+**

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

[](#installation)

```
composer require ekumanov/flarum-ext-forum-widgets
php flarum migrate
php flarum assets:publish
php flarum cache:clear
```

Then enable the extension in the admin panel under **Extensions &gt; Forum Stats Widget**.

> **Note:** Since Flarum 2.0 beta 8 (Laravel 13 upgrade), `php flarum assets:publish` is required after every `composer require` / `composer update` of any extension. Skipping it leaves stale compiled assets and can break the forum until the published assets match the running code.

Configuration
-------------

[](#configuration)

### Admin Settings

[](#admin-settings)

SettingDefaultDescriptionWidget layoutFull widthClassic sidebar widget or full-width bar above discussionsBar position (desktop)Inside the toolbarWhere to place the bar relative to the toolbar (full-width only). Options: above, inside, or belowBar position (mobile)Inside the toolbarWhere to place the bar on mobile. Options: above, inside, or below the toolbarWidget sidebar position-10Controls sidebar position; lower values = further down (classic layout only)Show expand/collapse toggle buttonEnabledShow the chevron button that expands/collapses the details panel. When disabled, the panel is still reachable by clicking the bar (full-bar mode), the online users cell (online-cell and classic modes), or via keyboard on the online cellExpanded panel width (desktop)Online users cell onlyIn full-width desktop mode, where the expanded panel anchors. **Online users cell only**: panel drops below the online users count; clicking the online cell expands. **Full bar width**: panel spans the full bar; clicking anywhere on the bar expandsShow online usersEnabledMaster toggle for the online users featureLast seen interval (minutes)5How many minutes since last activity to consider a user online (paired with the presence heartbeat default)Online users cache duration (seconds)30How long to cache the online users listEnable presence heartbeatEnabledWhether logged-in users with a focused tab send a background ping every minute to keep their last-seen timestamp fresh (and on the forum index, also auto-refresh the widget data). Disable for zero background trafficShow online guestsEnabledMaster toggle for guest counting. When on, each guest tab pings a small unauthenticated endpoint and the resulting count appears in the expanded panel as a dotted circle. Disabled when **Show online users** is offInclude guests in main online countEnabledWhen on, the bar (and panel section header) sums logged-in members and guests; the breakdown rows still list each component separately. Disabled when either **Show online users** or **Show online guests** is offShow discussions/posts/users/latestAll enabledIndividual toggles for each statisticStatistics cache duration (seconds)600How long to cache discussion/post/user counts and latest registrationIgnore private discussions in countDisabledExclude private discussions from the count### Permissions

[](#permissions)

All permissions default to **Everyone** (including guests):

- **View online users** — See the online users list and count. Also gates the online guests row when guest counting is enabled.
- **View discussions count** — See the discussions statistic
- **View posts count** — See the posts statistic
- **View users count** — See the users statistic
- **View latest registration** — See the latest registered user

### Caching

[](#caching)

The extension maintains **two separate online user caches**:

1. **Privileged cache** — For users with the "Always view user last seen time" permission (typically admins and moderators). Includes users who have hidden their online status.
2. **Regular cache** — For all other users. Hidden users are excluded and shown only as a count.

Both caches share a hardcoded ceiling of 500 entries — well above what any real forum sees concurrently. Beyond that the panel falls back to a "+N more" overflow row.

Both caches default to a 30-second TTL. The forum statistics cache (discussions, posts, users, latest registration) has a separate 600-second TTL and is automatically invalidated when content is created or deleted.

Updating
--------

[](#updating)

```
composer update ekumanov/flarum-ext-forum-widgets
php flarum migrate
php flarum assets:publish
php flarum cache:clear
```

Then hard-refresh the forum in your browser (Cmd+Shift+R on macOS, Ctrl+Shift+R on Windows/Linux) so it picks up the new CSS/JS.

`assets:publish` is required on Flarum 2.0 beta 8 and later — without it, the compiled CSS/JS on disk can fall out of sync with the running PHP and the forum may fail to render.

If the new version still doesn't appear:

- Confirm the new version is installed: `composer show ekumanov/flarum-ext-forum-widgets | grep versions`
- Check the served cache-buster hash changed: `curl -s https://your-forum/ | grep -oE 'forum\.css\?v=[a-f0-9]+'` — the hash should differ from before the update.
- If you're behind a CDN (e.g. Cloudflare) and the hash changed but you still see old bytes, purge that URL in your CDN.

Links
-----

[](#links)

- [Packagist](https://packagist.org/packages/ekumanov/flarum-ext-forum-widgets)
- [Discuss](https://discuss.flarum.org/d/38976-forum-stats-widget-with-online-users-too)
- [Report Issues](https://github.com/ekumanov/flarum-ext-forum-widgets/issues)

License
-------

[](#license)

MIT

###  Health Score

47

—

FairBetter than 93% of packages

Maintenance94

Actively maintained with recent releases

Popularity18

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

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 ~4 days

Total

19

Last Release

25d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/a23c4539c1c2283960743eb8b92e2c56fb2c5f33a7b44bd03a3d07b882fd67ed?d=identicon)[ekumanov](/maintainers/ekumanov)

---

Top Contributors

[![ekumanov](https://avatars.githubusercontent.com/u/24654623?v=4)](https://github.com/ekumanov "ekumanov (49 commits)")

---

Tags

extensionwidgetstatisticsflarumsidebaronline-users

### Embed Badge

![Health badge](/badges/ekumanov-flarum-ext-forum-widgets/health.svg)

```
[![Health](https://phpackages.com/badges/ekumanov-flarum-ext-forum-widgets/health.svg)](https://phpackages.com/packages/ekumanov-flarum-ext-forum-widgets)
```

###  Alternatives

[flarum-lang/russian

Russian language pack for Flarum.

12127.5k](/packages/flarum-lang-russian)[fof/sitemap

Generate a sitemap

1796.4k2](/packages/fof-sitemap)[flarum-lang/french

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

1936.5k](/packages/flarum-lang-french)[fof/masquerade

User profile builder extension for your Flarum forum.

2024.6k4](/packages/fof-masquerade)[flarum/gdpr

Features for GDPR, PII management

1433.4k20](/packages/flarum-gdpr)

PHPackages © 2026

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