sebdesign/laravel-stack-session-handler

Stack multiple session handlers for Laravel

dev-master 2019-10-23 17:58 UTC

This package is auto-updated.

Last update: 2024-04-24 04:00:26 UTC


README

Latest Version on Packagist Build Status Quality Score Total Downloads

A session handler that stacks multiple session handlers in Laravel's session store. The session data will be read from the first handler in the stack if possible, and will be written to all handlers.

Installation

You can install the package via composer:

composer require sebdesign/laravel-stack-session-handler

Usage

In your .env set the SESSION_DRIVER to stack.

SESSION_DRIVER=stack

Then in your config/session.php add a drivers array with the drivers you want to stack.

'drivers' => ['redis', 'database'],

Note that the order of drivers is important when starting the session: the first handler will be used to read the session data, and if there is no data it will read from the second handler, etc.

When the session is saved, it will be written to all the handlers, the order is not important in that case.

E.g. We can use redis to read sessions efficiently, and also database to be able to query the sessions.

If you forget to set the drivers array, the file driver will be used.

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email info@sebdesign.eu instead of using the issue tracker.

Credits

License

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