PHPackages                             harrisonratcliffe/browser-sessions-enhanced - 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. [Authentication &amp; Authorization](/categories/authentication)
4. /
5. harrisonratcliffe/browser-sessions-enhanced

AbandonedArchivedLibrary[Authentication &amp; Authorization](/categories/authentication)

harrisonratcliffe/browser-sessions-enhanced
===========================================

An enhanced version of the cjmellor/browser-sessions Laravel package to enable users to manage and monitor their active browser sessions. Allows users to view devices where they are logged in and provides options to terminate unrecognized or all sessions, enhancing account security

v1.0.15(1y ago)018MITPHPPHP ^8.2

Since Nov 9Pushed 1y ago1 watchersCompare

[ Source](https://github.com/harrisonratcliffe/browser-sessions-enhanced)[ Packagist](https://packagist.org/packages/harrisonratcliffe/browser-sessions-enhanced)[ Docs](https://github.com/harrisonratcliffe/browser-sessions-enhanced)[ RSS](/packages/harrisonratcliffe-browser-sessions-enhanced/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (10)Versions (17)Used By (0)

Warning

This package has been archived in favour of my pull request being merged to the original forked package: [cjmellor/browser-sessions](https://github.com/cjmellor/browser-sessions)

Warning

This package can only be used with the `database` driver for the Sessions. This is how it is done in Jetstream, so keep this in mind as it may turn you off knowing you need to manage sessions in the database.

Browser Sessions Enhanced
=========================

[](#browser-sessions-enhanced)

**Forked from [cjmellor/browser-sessions](https://github.com/cjmellor/browser-sessions)**

*I modified this package so I can return the session ID for revoking specific/single sessions. Thought I'd publish it in case anyone else wanted to do the same.*

This package allows you to log out sessions that are active on other devices.

You may find this useful if you have logged in on a different device, or you have let someone else use your account, or you have forgotten to log out of a public computer. It can especially be useful if you see suspicious device activity on your account.

Note

This code has been extracted from [Laravel Jetstream](https://jetstream.laravel.com) and cannot be used outside a Laravel application.

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

[](#installation)

You can install the package via Composer:

```
composer require harrisonratcliffe/browser-sessions-enhanced
```

Publishing the Configuration
----------------------------

[](#publishing-the-configuration)

To publish the configuration file for this package, run the following Artisan command:

```
php artisan vendor:publish --provider="Harrisonratcliffe\BrowserSessionsEnhanced\BrowserSessionsEnhancedServiceProvider"
```

This will copy the `browser-sessions-enhanced.php` configuration file to your application's config directory, allowing you to customize its settings.

### Configurable Options

[](#configurable-options)

You can customize the following options in the published `config/browser-sessions-enhanced.php` file:

`include_session_id: (default: false)`

Usage
-----

[](#usage)

### Retrieving A User's Current Sessions

[](#retrieving-a-users-current-sessions)

Use the `BrowserSessionsEnhanced` facade to retrieve all the current user's sessions:

```
use Harrisonratcliffe\BrowserSessionsEnhanced\Facades\BrowserSessionsEnhanced;

BrowserSessionsEnhanced::sessions();
```

This will return an object with some information about each session:

```
[
  {
    "session_id": "i0HaKKMTcGZBMe1COf06O7HKnkeFmLwUsg6nh43c",
    "device": {
      "browser": "Safari",
      "desktop": true,
      "mobile": false,
      "platform": "OS X"
    },
    "ip_address": "127.0.0.1",
    "is_current_device": true,
    "last_active": "1 second ago"
  }
]
```

### Logging Out Other Browser Sessions

[](#logging-out-other-browser-sessions)

Use the `BrowserSessionsEnhanced` facade to log out all the user's other browser sessions:

```
use Harrisonratcliffe\BrowserSessionsEnhanced\Facades\BrowserSessionsEnhanced;

BrowserSessionsEnhanced::logoutOtherBrowserSessions();
```

Note

A `password` must be sent along to the method to confirm the user's identity. Only then will the sessions be removed. See below on how you would implement this.

### Views

[](#views)

The package does not come with any pre-defined views to use. Here is an example though on how this could be implemented

In your `routes/web.php` file add the following route:

```
use Harrisonratcliffe\BrowserSessionsEnhanced\Facades\BrowserSessionsEnhanced;

Route::delete('logout-browser-sessions', function () {
    BrowserSessionsEnhanced::logoutOtherBrowserSessions();

    return back()->with('status', 'Logged out of other browser sessions.');
})->name('logout-browser-sessions');
```

Then in your view, you can add a form to submit a `DELETE` request to the above route:

```

    @csrf
    @method('DELETE')

    Logout Other Sessions

```

Retrieve the Users' Last Activity
---------------------------------

[](#retrieve-the-users-last-activity)

Get the users' last activity by using the `getUserLastActivity` method:

```
use Harrisonratcliffe\BrowserSessionsEnhanced\Facades\BrowserSessionsEnhanced;

BrowserSessionsEnhanced::getUserLastActivity();
```

You can also view the date in a human-readable format:

```
use Harrisonratcliffe\BrowserSessionsEnhanced\Facades\BrowserSessionsEnhanced;

BrowserSessionsEnhanced::getUserLastActivity(human: true);
```

Credits
-------

[](#credits)

- [Chris Mellor](https://github.com/cjmellor)
- [Harrison Ratcliffe](https://github.com/harrisonratcliffe)

License
-------

[](#license)

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

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance40

Moderate activity, may be stable

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity59

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

16

Last Release

546d ago

### Community

Maintainers

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

---

Top Contributors

[![harrisonratcliffe](https://avatars.githubusercontent.com/u/53269265?v=4)](https://github.com/harrisonratcliffe "harrisonratcliffe (33 commits)")

---

Tags

laravelbrowser-sessionsbrowser-sessions-enhanced

###  Code Quality

TestsPest

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/harrisonratcliffe-browser-sessions-enhanced/health.svg)

```
[![Health](https://phpackages.com/badges/harrisonratcliffe-browser-sessions-enhanced/health.svg)](https://phpackages.com/packages/harrisonratcliffe-browser-sessions-enhanced)
```

###  Alternatives

[bezhansalleh/filament-shield

Filament support for `spatie/laravel-permission`.

2.8k2.9M88](/packages/bezhansalleh-filament-shield)[cjmellor/browser-sessions

A Laravel package to enable users to manage and monitor their active browser sessions. Allows users to view devices where they are logged in and provides options to terminate unrecognized or all sessions, enhancing account security

26752.2k](/packages/cjmellor-browser-sessions)[truckersmp/steam-socialite

Laravel Socialite provider for Steam OpenID.

1516.7k](/packages/truckersmp-steam-socialite)[pschocke/laravel-telegram-login-widget

Easily integrate Telegrams login widget into your Laravel application to send Telegram messages

1610.4k](/packages/pschocke-laravel-telegram-login-widget)

PHPackages © 2026

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