Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Laravel Users Online

Laravel Users Online Laravel Package

highideas/laravel-users-online

Track which users are online in your Laravel app with this lightweight package. It records activity via cache or database drivers, lets you check online status, list active users, and configure timeouts, with simple helper methods and Blade-friendly access.

View on GitHub
Deep Wiki
Context7

Show the users online in your Laravel application

Frequently asked questions about Laravel Users Online
How do I install highideas/laravel-users-online in a Laravel application?
Install it with Composer (composer require highideas/laravel-users-online); the service provider is auto-discovered. Publish the package config and migration with vendor:publish, and register the supplied middleware on the web group so requests get recorded. After that, run the migration if you are using the database driver.
Which Laravel and PHP versions does this package support?
The last release was October 2019, which puts it in the Laravel 5.x/6.x and PHP 7.x era. Its Composer constraints almost certainly exclude Laravel 9 and above, so it will not install cleanly on Laravel 10, 11 or 12. Check the composer.json constraints against your actual PHP and Laravel versions before adopting it, and expect to fork or vendor the code if you are on a newer stack.
How does the package actually track which users are online?
A service provider registers a middleware that records authenticated user activity on each request, storing a last-activity marker through the configured driver. Helper methods and an Eloquent scope then read that data against a time window to decide who counts as online. The whole surface is small, roughly a middleware plus a model scope, which makes it easy to audit.
Should I use the cache driver or the database driver for online tracking?
The cache driver avoids a database write per request but only works correctly if your cache store is shared across nodes, such as Redis. The database driver is easier to query and persist but adds a write on every authenticated request, which becomes real cost and lock contention at scale. Choose based on your traffic profile and whether your cache is centralized.
How do I check whether a specific user is online or list active users?
The package exposes helper methods and an online scope, so you can test a single user's status or fetch the full list of active users in a controller or view. Because the results are ordinary model data, it is straightforward to show an online count or status badge in Blade. The configured timeout decides the window that counts as online.
How do I configure the online timeout or activity threshold?
The timeout lives in the published config file, usually expressed in minutes, and should be set slightly larger than your expected activity interval. Users whose last activity falls outside that window are simply treated as offline by the query. No extra writes or state changes are needed to expire them.
How are stale online records cleaned up?
With the database driver, old activity rows remain in the table until something removes them, and the online query typically relies on a time-window filter rather than deleting data. You should schedule your own cleanup command or prune job to keep the table small. The package does not ship automatic pruning out of the box.
Does it work in multi-server or distributed deployments?
Online accuracy is only as good as the store behind it: with shared Redis or database sessions and cache, counts stay consistent across nodes. With file sessions or a node-local cache, each server sees only the users it handled, so your online count fragments. There is no additional distributed coordination beyond what the underlying driver already provides.
Is this package safe to use in production on modern Laravel versions?
The package has had no releases since 2019, only around 200 stars, and no active maintainer, so you would own every bug and framework upgrade. On Laravel 10 and above, expect Composer conflicts and PHP 8 problems such as untyped properties and deprecated helpers. The code is small enough that vendoring or rewriting it is a cheap fallback.
Are there better alternatives, or should I build this feature myself?
Laravel's built-in session and Auth primitives plus a last_activity column, a small middleware and a scheduled prune can reproduce this feature in well under a hundred lines. You can also extend an existing activity log you already maintain. Given the maintenance risk of an unmaintained dependency, re-implementing or forking is usually the stronger choice.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
dbravoan/dbcms-admin-theme-dbcms
dbravoan/dbcms-theme-db-cyber
dbravoan/dbcms-blocks-basic
dbravoan/dbcms-module-content-audit
dbravoan/dbcms-module-ai-assistant
paygate-to/paygate-php
padosoft/askmydocs-connector-base
defstudio/supercharged-carbon
bernskioldmedia/laravel-matomo
bernskioldmedia/laravel-harvest
bernskiold/laravel-data-scrubber
bernskiold/laravel-currency-converter
bernskiold/laravel-campaign-monitor
bernskioldmedia/laravel-autotranslate
siberfx/telegram-bot
roy-sandip/laravel-view-extended
gregsphotography/site-builder-core
roy-sandip/laravel-view
anodyne/blade-fluentui-icons
webx-ui/module-catalog-collections