Download the PHP package stanleykinkelaar/laravel-browser-sessions-lite without Composer

On this page you can find all versions of the php package stanleykinkelaar/laravel-browser-sessions-lite. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-browser-sessions-lite

πŸš€ Laravel Browser Sessions Lite

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

Ever wondered who's logged into your app right now? πŸ€” This lightweight Laravel package lets users see all their active browser sessions and securely log out suspicious onesβ€”all without the bloat of heavy device detection libraries.

Perfect for apps that need Jetstream-style session management but want to keep it simple and fast.


✨ Features


🎯 Use Cases


πŸ“¦ Requirements

Requirement Version
PHP 8.2+
Laravel 10.x, 11.x, 12.x
Session Driver database

πŸš€ Installation

Step 1: Install via Composer

Step 2: Configure Database Sessions

This package requires Laravel's database session driver. Update your .env:

Create the sessions table (if you haven't already):

Step 3: Publish Assets (Optional)

Publish config file to customize routes and middleware:

Publish views to customize the UI:


βš™οΈ Configuration

The config file (config/browser-sessions-lite.php) allows you to customize behavior:

Pro tip: Need admin-only access? Change middleware to ['web', 'auth', 'admin']


🎨 Usage

Web UI (Blade)

The package automatically registers these routes:

Method URI Description
GET /user/browser-sessions View all sessions (Blade UI)
DELETE /user/browser-sessions/others Logout other sessions

Simply visit /user/browser-sessions in your browser to see the beautiful UI!

πŸŽ‰ That's it! The view looks like this:


Programmatic Usage (PHP)

List Sessions for Current User

Logout Other Sessions (with password verification)

Force Logout (admin use - skips password check)

Check for Multiple Sessions


JSON API Usage (for SPAs & Mobile Apps)

All routes support JSON responses when using Accept: application/json header.

List Sessions (JSON)

Response:

Logout Other Sessions (JSON)

Success Response:

Error Response (422):


πŸ” Device Detection

The package uses simple regex patterns for device hints (no external libraries, zero bloat):

User Agent Contains Device Hint Shown
iPhone, iPad, iPod iOS Device πŸ“±
Android Android Device πŸ€–
Edg Edge Browser 🌐
Chrome Chrome Browser 🌐
Firefox Firefox Browser 🦊
Safari Safari Browser 🧭
Windows Windows PC πŸ’»
Macintosh, Mac OS Mac Computer 🍎
Linux Linux PC 🐧

Note: Detection order matters! Edge and Chrome are checked before Safari (since their UAs contain "Safari").


🎬 Example Integrations

Integration 1: Laravel Blade Layout

Integration 2: Vue/React SPA

Integration 3: Livewire Component


πŸ€” Why No Device Detection Libraries?

This package intentionally avoids external device detection libraries like jenssegers/agent or mobiledetect/mobiledetectlib because:

βœ… Faster installation - No heavy dependencies to download βœ… Fewer conflicts - Less chance of version mismatch issues βœ… Smaller footprint - Keeps your vendor/ folder lean βœ… Easier maintenance - Simple regex patterns anyone can understand βœ… Focused purpose - Does one thing (session management) really well

Need advanced device detection? (browser versions, OS versions, device models, etc.) Consider using a dedicated package alongside this one. This package focuses on giving users just enough info to identify their devicesβ€”without the bloat.


πŸ§ͺ Testing

This package includes a comprehensive Pest test suite covering:

Run Tests

Example Test Output


πŸ› οΈ How to Test in Your Package

Since this is a Spatie-style Laravel package, testing is set up using:

  1. Orchestra Testbench - Simulates a Laravel app environment
  2. Pest PHP - Modern testing framework
  3. In-memory SQLite - Fast test database

Running Tests During Development

Testing in a Real Laravel App

Want to test this package in your actual Laravel app before release?

Option 1: Composer Local Path

Add to your Laravel app's composer.json:

Then run:

Option 2: Testbench Workbench (Spatie Style)

Use Orchestra Testbench's workbench feature:

Visit http://localhost:8000/user/browser-sessions to test the UI!


πŸ“‹ Architecture Overview

This package follows Spatie conventions and clean architecture:

Design principles:


πŸ” Security Best Practices

This package is designed with security in mind:

βœ… Password verification required - Users must enter their password to log out other sessions βœ… Laravel's current_password rule - Uses built-in validation βœ… Auth middleware by default - Routes protected out of the box βœ… CSRF protection - Form submissions are CSRF-protected βœ… Session rehashing - Uses Laravel's Auth::logoutOtherDevices()

Reporting Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.


🀝 Contributing

Contributions are welcome! Here's how you can help:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Write tests for your changes
  4. Run the test suite (composer test)
  5. Fix code style (composer format)
  6. Commit your changes (git commit -m 'Add amazing feature')
  7. Push to your branch (git push origin feature/amazing-feature)
  8. Open a Pull Request

Please see CONTRIBUTING.md for detailed guidelines.


πŸ“ Changelog

All notable changes are documented in CHANGELOG.md.


πŸ“œ License

The MIT License (MIT). See LICENSE.md for details.


πŸ™ Credits


⭐ Show Your Support

If this package helped you, consider:


Made with ❀️ by Stanley Kinkelaar
Built for the Laravel community πŸŽ‰


All versions of laravel-browser-sessions-lite with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2|^8.3|^8.4
spatie/laravel-package-tools Version ^1.16
illuminate/contracts Version ^10.0|^11.0|^12.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package stanleykinkelaar/laravel-browser-sessions-lite contains the following files

Loading the files please wait ...