PHPackages                             slowestwind/laravel-tab-session-guard - 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. slowestwind/laravel-tab-session-guard

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

slowestwind/laravel-tab-session-guard
=====================================

A Laravel package that allows developers to restrict and control how many tabs, sessions, and resource windows a user can open

701PHP

Since Sep 13Pushed 9mo agoCompare

[ Source](https://github.com/slowestwind/tab-session-guard)[ Packagist](https://packagist.org/packages/slowestwind/laravel-tab-session-guard)[ RSS](/packages/slowestwind-laravel-tab-session-guard/feed)WikiDiscussions main Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

Laravel Tab Session Guard
=========================

[](#laravel-tab-session-guard)

A Laravel package that allows developers to restrict and control how many tabs, sessions, and resource windows a user can open, with a flexible configuration system.

Features
--------

[](#features)

- **Max Tabs Control**: Limit how many tabs a user can open for specific routes
- **Role-based Restrictions**: Different limits for different user roles
- **Application Single-Session**: Ensure only one Application can be open at a time
- **Global Tab Limits**: Control total tabs across the entire application
- **Incognito Prevention**: Track via browser localStorage + server sessions
- **Graceful Alerts**: User-friendly messages with customizable responses
- **Audit &amp; Logging**: Optional logging of violations and attempts
- **Fully Configurable**: Toggle features and customize limits per your needs

> 🚀 Inspired by real-world CRM use cases where multiple open sessions lead to errors and performance issues.

Key Benefits
------------

[](#key-benefits)

- 🔒 **Prevent Resource Conflicts**: Stop users from opening multiple instances of the same application/form
- 🛡️ **Reduce Server Load**: Limit concurrent sessions to improve performance
- ⚙️ **Flexible Configuration**: Easily customize limits per role, route, or globally
- 🖥️ **Real-time Tracking**: Monitor active tabs and sessions in real-time
- 🔄 **Seamless Integration**: Middleware support for automatic route protection
- 🎛️ **Granular Control**: Enable/disable features as per your project needs

Real-World Use Cases
--------------------

[](#real-world-use-cases)

### CRM Application Management

[](#crm-application-management)

- **Prevent Duplicate Applications**: Stop users from accidentally opening the same application in multiple tabs
- **Role-based Limits**: Users can open up to 3 profile tabs but only 1 application at a time
- **Data Integrity**: Prevent conflicts when multiple tabs try to modify the same application

### Performance Optimization

[](#performance-optimization)

- **Server Load Management**: Limit the number of concurrent sessions per user
- **Memory Usage Control**: Prevent users from overwhelming the system with too many open tabs
- **Database Connection Limits**: Reduce strain on database resources

### User Experience

[](#user-experience)

- **Guided Workflow**: Keep users focused on current tasks
- **Error Prevention**: Avoid confusion from multiple open instances
- **Graceful Notifications**: User-friendly messages when limits are reached

Requirements
------------

[](#requirements)

- **PHP**: 8.1 or higher
- **Laravel**: 9.x, 10.x, 11.x, or 12.x
- **Browser**: Modern browsers with localStorage support

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

[](#installation)

Install the package via Composer:

```
composer require slowestwind/laravel-tab-session-guard
```

### Laravel Auto-Discovery

[](#laravel-auto-discovery)

The package will automatically register its service provider and facade.

For Laravel versions &lt; 5.5, add the service provider to `config/app.php`:

```
'providers' => [
    // Other providers...
    SlowestWind\TabSessionGuard\Providers\TabSessionGuardServiceProvider::class,
],
```

And optionally add the facade:

```
'aliases' => [
    // Other aliases...
    'TabGuard' => SlowestWind\TabSessionGuard\Facades\TabGuard::class,
],
```

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

[](#configuration)

Publish the configuration file:

```
php artisan vendor:publish --tag=tab-guard-config
```

Optionally publish views and assets:

```
php artisan vendor:publish --tag=tab-guard-views
php artisan vendor:publish --tag=tab-guard-assets
```

Configuration Options
---------------------

[](#configuration-options)

Complete Configuration Reference
--------------------------------

[](#complete-configuration-reference)

```
