PHPackages                             lvlup-dev/laravel-user-last-seen-at - 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. lvlup-dev/laravel-user-last-seen-at

ActiveLaravel-package

lvlup-dev/laravel-user-last-seen-at
===================================

Adds a nullable last\_seen\_at column on users and middleware to update it on each authenticated request.

v1.0.0(1mo ago)00MITPHPPHP ^8.2

Since Mar 29Pushed 1mo agoCompare

[ Source](https://github.com/lvlup-dev/laravel-user-last-seen-at)[ Packagist](https://packagist.org/packages/lvlup-dev/laravel-user-last-seen-at)[ Docs](https://www.lvlup.fr)[ RSS](/packages/lvlup-dev-laravel-user-last-seen-at/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (9)Versions (2)Used By (0)

Laravel User Last Seen At
=========================

[](#laravel-user-last-seen-at)

[![Latest Version on Packagist](https://camo.githubusercontent.com/fb94432e6cb5d6b2d950950a987b0009261f889dd077a0c4b5d5fb8b7cce2976/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6c766c75702d6465762f6c61726176656c2d757365722d6c6173742d7365656e2d61742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/lvlup-dev/laravel-user-last-seen-at)[![Total Downloads](https://camo.githubusercontent.com/7e4737f057f7a401e28c3c982dd5d508476cddcedf7b373c49918664bb1dfdea/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6c766c75702d6465762f6c61726176656c2d757365722d6c6173742d7365656e2d61742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/lvlup-dev/laravel-user-last-seen-at)[![MIT Licensed](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE)

Store a **`last_seen_at`** timestamp on your `users` table and refresh it on each request for authenticated users—useful for “online recently” indicators or light activity tracking without extra tables.

Maintained by **[Lvlup](https://www.lvlup.fr)**.

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

[](#installation)

You can install the package via composer:

```
composer require lvlup-dev/laravel-user-last-seen-at
```

Run the migrations (the package registers its migration automatically):

```
php artisan migrate
```

Usage
-----

[](#usage)

### Registering the Middleware

[](#registering-the-middleware)

You need to append the middleware to your route groups (e.g., the `web` group). In Laravel 11+, you can do this in your `bootstrap/app.php` file:

```
// bootstrap/app.php
->withMiddleware(function (Illuminate\Foundation\Configuration\Middleware $middleware): void {

    // Using the class name...
    $middleware->web(append: [
        \LvlupDev\UserLastSeenAt\Http\Middleware\UserLastSeen::class,
    ]);

    // ...or using the alias registered by this package
    $middleware->web(append: [
        'lastSeenAt',
    ]);
})
```

*Note: Guests are automatically skipped, and no database write occurs for unauthenticated users.*

### Your `User` model

[](#your-user-model)

This package does **not** ship a custom `User` model—you keep yours.

The middleware updates the timestamp using **`forceFill`** and **`saveQuietly`**. This means:

1. `last_seen_at` does **not** need to be added to your `$fillable` array.
2. It will **not** trigger any `updated` or `saved` Eloquent events, saving performance and preventing infinite loops in observers.

You may still want to cast it as a datetime in your `User` model for convenience:

```
protected function casts(): array
{
    return [
        'last_seen_at' => 'datetime',
    ];
}
```

Alternatives
------------

[](#alternatives)

**`laravel-user-last-seen-at`** is intentionally minimal: one nullable column and one middleware.

If you need comprehensive audit trails, rich activity feeds, or per-model event history, we recommend using [spatie/laravel-activitylog](https://github.com/spatie/laravel-activitylog) or building a custom event-driven design.

Credits
-------

[](#credits)

*laravel-user-last-seen-at* is built and maintained by [LVLUP](https://www.lvlup.fr/). We help businesses drive operational efficiency through strategic consulting, tailored software development, and advanced AI Agent integrations.

Read [this blog post (in French)](https://www.lvlup.fr/blog/package-laravel-user-is-admin) on why we built this package to keep activity tracking pragmatic and efficient.

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE) for more information.

###  Health Score

37

—

LowBetter than 83% of packages

Maintenance90

Actively maintained with recent releases

Popularity0

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity46

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

Unknown

Total

1

Last Release

46d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/91f10f8dfd1c4cad561f5c61e01b91f0820c2d08e9c67c8d092b8613bf40752b?d=identicon)[dsampaolo](/maintainers/dsampaolo)

---

Top Contributors

[![dsampaolo](https://avatars.githubusercontent.com/u/1384803?v=4)](https://github.com/dsampaolo "dsampaolo (1 commits)")

---

Tags

middlewarelaraveluseractivitylast-seen

###  Code Quality

TestsPest

### Embed Badge

![Health badge](/badges/lvlup-dev-laravel-user-last-seen-at/health.svg)

```
[![Health](https://phpackages.com/badges/lvlup-dev-laravel-user-last-seen-at/health.svg)](https://phpackages.com/packages/lvlup-dev-laravel-user-last-seen-at)
```

###  Alternatives

[laravel/pulse

Laravel Pulse is a real-time application performance monitoring tool and dashboard for your Laravel application.

1.7k12.1M99](/packages/laravel-pulse)[laravel/passport

Laravel Passport provides OAuth2 server support to Laravel.

3.4k85.0M532](/packages/laravel-passport)[laravel/cashier

Laravel Cashier provides an expressive, fluent interface to Stripe's subscription billing services.

2.5k25.9M107](/packages/laravel-cashier)[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

9682.1M97](/packages/roots-acorn)[psalm/plugin-laravel

Psalm plugin for Laravel

3274.9M308](/packages/psalm-plugin-laravel)[yadahan/laravel-authentication-log

Laravel Authentication Log provides authentication logger and notification for Laravel.

416632.8k5](/packages/yadahan-laravel-authentication-log)

PHPackages © 2026

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