PHPackages                             evanschleret/laravel-user-presence - 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. evanschleret/laravel-user-presence

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

evanschleret/laravel-user-presence
==================================

Another Laravel package for tracking user presence in real-time applications.

v1.0.1(9mo ago)0110MITPHPPHP ^8.2

Since Jul 29Pushed 9mo agoCompare

[ Source](https://github.com/EvanSchleret/laravel-user-presence)[ Packagist](https://packagist.org/packages/evanschleret/laravel-user-presence)[ Docs](https://github.com/evanschleret/laravel-user-presence)[ RSS](/packages/evanschleret-laravel-user-presence/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (3)Dependencies (4)Versions (11)Used By (0)

[![Laravel User Presence logo](logo.png)](logo.png)Laravel User Presence
=====================

[](#laravel-user-presence)

[![Latest Version on Packagist](https://camo.githubusercontent.com/d49615d5456d0a0b8860594a0d8c68c818d26a613f27f306d981530c9fb70a77/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6576616e7363686c657265742f6c61726176656c2d757365722d70726573656e63652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/evanschleret/laravel-user-presence)[![Total Downloads](https://camo.githubusercontent.com/13161cb41ccf6082c21586b4de160f7a6e2593c154cd7c3a40effda725f56eed/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6576616e7363686c657265742f6c61726176656c2d757365722d70726573656e63652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/evanschleret/laravel-user-presence)

This package allows you to track user presence in your Laravel application. It provides a simple way to determine if a user is online, offline, or idle. Useful for chat apps, dashboards, real-time features, and more.

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

[](#installation)

```
composer require evanschleret/laravel-user-presence
```

Optionally, publish the config file:

```
php artisan vendor:publish --provider="EvanSchleret\LaravelUserPresence\Providers\LaravelUserPresenceServiceProvider"
```

Requirements
============

[](#requirements)

- Laravel 10 or 11
- PHP &gt;= 8.2
- A last\_seen\_at column on your users table (or whichever model you attach presence to)

```
$table->timestamp('last_seen_at')->nullable();

```

You could also publish the migration file to create this column:

```
php artisan vendor:publish --provider="EvanSchleret\LaravelUserPresence\Providers\LaravelUserPresenceServiceProvider" --tag="migrations"
```

Then run the migration:

```
php artisan migrate
```

Usage
=====

[](#usage)

Trait Add the trait to your User model:

```
use EvanSchleret\LaravelUserPresence\Traits\HasUserPresence;

class User extends Authenticatable
{
    use HasUserPresence;
}
```

Middleware
----------

[](#middleware)

Add the UpdateLastSeen middleware to your web or api group to update presence on each request:

```
// app/Http/Kernel.php
protected $middlewareGroups = [
    'web' => [
        // ...
        \EvanSchleret\LaravelUserPresence\Http\Middleware\UpdateLastSeen::class,
    ],
];
```

Attributes available
--------------------

[](#attributes-available)

After setup, the following attributes will be available on the user model:

```
$user->is_online       // true if active in the last 2 minutes
$user->is_offline      // inverse of is_online
$user->is_idle         // true if inactive for 2–10 minutes
$user->last_seen_ago   // "3 minutes ago", "never", etc.
$user->presence_status // 'online', 'away', or 'offline'

```

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

[](#configuration)

You can customize time thresholds in the published config file:

```
// config/user-presence.php
return [
    'online_threshold' => 300,  // in seconds
    'idle_threshold' => 600,     // in seconds
    'guard' => 'web', // or 'api' / 'sanctum' if using API authentication
];
```

Events
------

[](#events)

The package dispatches these events when presence changes:

```
UserWentOnline
UserWentOffline
UserWentIdle

```

Roadmap
=======

[](#roadmap)

- Tests
- Redis driver for real-time broadcast presence
- Eloquent observer-based updates

Contributing
============

[](#contributing)

I'm always open to contributions! Feel free to submit issues or pull requests on GitHub.

License
=======

[](#license)

This package is open-sourced software licensed under the [MIT license](LICENSE.md).

###  Health Score

35

—

LowBetter than 80% of packages

Maintenance56

Moderate activity, may be stable

Popularity13

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity55

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

Total

10

Last Release

293d ago

Major Versions

v0.1.7 → v1.02025-07-29

PHP version history (2 changes)v0.1PHP ^8.1

v0.1.4PHP ^8.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/7660bef746d281508554102acf61e357ed434a69c94e499ca6e569176a1a16ba?d=identicon)[EvanSchleret](/maintainers/EvanSchleret)

---

Top Contributors

[![EvanSchleret](https://avatars.githubusercontent.com/u/55502199?v=4)](https://github.com/EvanSchleret "EvanSchleret (9 commits)")

---

Tags

laravelpresencetrakinglaravelEvanSchleretpresence

###  Code Quality

TestsPest

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/evanschleret-laravel-user-presence/health.svg)

```
[![Health](https://phpackages.com/badges/evanschleret-laravel-user-presence/health.svg)](https://phpackages.com/packages/evanschleret-laravel-user-presence)
```

###  Alternatives

[barryvdh/laravel-ide-helper

Laravel IDE Helper, generates correct PHPDocs for all Facade classes, to improve auto-completion.

14.9k123.0M687](/packages/barryvdh-laravel-ide-helper)[interaction-design-foundation/laravel-geoip

Support for multiple Geographical Location services.

17221.0k3](/packages/interaction-design-foundation-laravel-geoip)[nedwors/navigator

A Laravel package to ease defining navigation menus

433.1k](/packages/nedwors-navigator)[xefi/faker-php-laravel

Faker php integration with laravel

1915.1k](/packages/xefi-faker-php-laravel)[dcblogdev/laravel-junie

Install pre-configured guides for Jetbrains Junie

392.5k](/packages/dcblogdev-laravel-junie)

PHPackages © 2026

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