PHPackages                             anubra266/browser-sessions - 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. [Security](/categories/security)
4. /
5. anubra266/browser-sessions

ActiveLibrary[Security](/categories/security)

anubra266/browser-sessions
==========================

Manage Browser Sessions in a Laravel Application

v1.1.2(5y ago)21323MITPHPPHP ^7.4|^8.0CI failing

Since Dec 22Pushed 2y ago1 watchersCompare

[ Source](https://github.com/anubra266/browser-sessions)[ Packagist](https://packagist.org/packages/anubra266/browser-sessions)[ Docs](https://github.com/anubra266/browser-sessions)[ GitHub Sponsors](https://github.com/sponsors/spatie)[ Fund](https://spatie.be/open-source/support-us)[ RSS](/packages/anubra266-browser-sessions/feed)WikiDiscussions main Synced today

READMEChangelog (4)Dependencies (5)Versions (5)Used By (0)

Browser Sessions
================

[](#browser-sessions)

[![GitHub Workflow Status](https://camo.githubusercontent.com/7b63d09da0b6b8eb52508843636e1c14488bbeb9519a43122aa326eaaa94e069/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f616e756272613236362f62726f777365722d73657373696f6e732f54657374733f7374796c653d666f722d7468652d6261646765)](https://github.com/anubra266/browser-sessions/actions?query=workflow%3ATests)[![Latest Version on Packagist](https://camo.githubusercontent.com/f33ec697d8c3cf22708e9e17df82d01444972a2bfb8d2564c4cf71bc8f89c519/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f616e756272613236362f62726f777365722d73657373696f6e732e7376673f7374796c653d666f722d7468652d6261646765266c6f676f3d7061636b6167697374)](https://packagist.org/packages/anubra266/browser-sessions)[![License](https://camo.githubusercontent.com/faae22f8b655cbdb720ff18c62bf57112e9ded55a6f8c0ed12f188c9b1c8ad66/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f616e756272613236362f62726f777365722d73657373696f6e732e7376673f7374796c653d666f722d7468652d6261646765)](https://github.com/anubra266/browser-sessions/blob/master/LICENSE)[![Total Downloads](https://camo.githubusercontent.com/d99df34f89c5f3ae6c846333ae5f0e11e95b9099d0450710f9cee93916ca7726/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f616e756272613236362f62726f777365722d73657373696f6e732e7376673f7374796c653d666f722d7468652d6261646765)](https://packagist.org/packages/anubra266/browser-sessions)[![Author](https://camo.githubusercontent.com/8bfebd20dddf7382e1a018ba0ec8bc4db5032dac154bd786abccbbbf024d3ce5/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f617574686f722d40616e756272613236362d626c75652e7376673f7374796c653d666f722d7468652d6261646765)](https://github.com/anubra266)

Manage User Accounts' Browser Sessions in a Laravel Application. Contents
--------

[](#contents)

- [Features](#Features)
- [Installation](#installation)
- [Usage](#Usage)
    - [Get Sessions](#Get-Sessions)
        - [Backend](#Backend)
        - [Output Format](#Output-Format)
    - [Logout All Sessions](#Logout-All-Sessions)
- [Testing](#Testing)
- [Credits](#Credits)
- [License](#License)

Features
--------

[](#features)

- List Browser Sessions
- Logout All Browser Sessions

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

[](#installation)

You can install the package via composer:

```
composer require anubra266/browser-sessions
```

Edit `config/session.php` and change the Driver

```
'driver' => 'database'
```

Create Session Migration and Migrate

```
php artisan session:table

php artisan migrate
```

Make sure that the `Illuminate\Session\Middleware\AuthenticateSession` middleware is present and un-commented in your `app/Http/Kernel.php class` web middleware group:

```
'web' => [
    // ...
    \Illuminate\Session\Middleware\AuthenticateSession::class,
    // ...
],
```

You can publish the config file with:

```
php artisan vendor:publish --provider="Anubra266\BrowserSessions\BrowserSessionsServiceProvider" --tag="config"
```

Usage
-----

[](#usage)

### Get Sessions

[](#get-sessions)

#### **Backend**

[](#backend)

```
# SettingsController.php

//Get a collection of sessions
public function showSessions(){
    // This method accepts the request instance
    $sessions = BrowserSessions::collect(request());
    //Pass the collection to your view
    return view('sessions', ["sessions" => $sessions->all()]);

}
```

#### **Output Format**

[](#output-format)

```
{
    'agent' :{
        'is_desktop' : boolean,
        'platform' : string,
        'browser' : string,
    },
    'ip_address' : string,
    'is_current_device' : boolean,
    'last_active' : string,
}
```

Logout All Sessions
-------------------

[](#logout-all-sessions)

Send a Post Request to the named route `browser.sessions.logout`.

```

    @csrf

    Logout All Devices

```

**NB**:

- You can change this named route by changing the value of the `logoutAllSessions` key in `config/browser-sessions.php`.
- Validation errors are returned in errorBag named `logoutOtherBrowserSessions`. You can change this by editing the value of the `errorBag` key in `config/browser-sessions.php`.

Testing
-------

[](#testing)

```
composer test
```

Credits
-------

[](#credits)

- [Abraham](https://github.com/Abraham)

License
-------

[](#license)

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

###  Health Score

30

—

LowBetter than 62% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 97.8% 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 ~1 days

Total

4

Last Release

2015d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/30869823?v=4)[Abraham](/maintainers/anubra266)[@anubra266](https://github.com/anubra266)

---

Top Contributors

[![anubra266](https://avatars.githubusercontent.com/u/30869823?v=4)](https://github.com/anubra266 "anubra266 (44 commits)")[![otilor](https://avatars.githubusercontent.com/u/39733548?v=4)](https://github.com/otilor "otilor (1 commits)")

---

Tags

laravelphpsecuritysession-managementbrowser-sessionsanubra266

###  Code Quality

TestsPHPUnit

Static AnalysisPsalm

Type Coverage Yes

### Embed Badge

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

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

###  Alternatives

[illuminate/encryption

The Illuminate Encryption package.

9630.7M322](/packages/illuminate-encryption)[spatie/laravel-pdf

Create PDFs in Laravel apps

1.0k4.8M46](/packages/spatie-laravel-pdf)[psalm/plugin-laravel

Psalm plugin for Laravel

3355.3M346](/packages/psalm-plugin-laravel)[laravel/ai

The official AI SDK for Laravel.

1.0k3.2M186](/packages/laravel-ai)[moonshine/moonshine

Laravel administration panel

1.3k253.1k79](/packages/moonshine-moonshine)[illuminate/console

The Illuminate Console package.

13046.0M6.4k](/packages/illuminate-console)

PHPackages © 2026

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