PHPackages                             krisell/laravel-session-migrator - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. krisell/laravel-session-migrator

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

krisell/laravel-session-migrator
================================

Migrate Laravel session serialization method and driver without dropping any sessions.

v1.0.0(4y ago)133MITPHPPHP ^8.0.2

Since Mar 22Pushed 4y ago1 watchersCompare

[ Source](https://github.com/Krisell/laravel-session-migrator)[ Packagist](https://packagist.org/packages/krisell/laravel-session-migrator)[ Docs](https://github.com/krisell/laravel-session-migrator)[ RSS](/packages/krisell-laravel-session-migrator/feed)WikiDiscussions main Synced 1mo ago

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

Laravel Session Migrator
========================

[](#laravel-session-migrator)

[![Latest Version on Packagist](https://camo.githubusercontent.com/c0d7f87b8d64edc765a2b8e3340419edd7aaf987441e9de92731b8057dde9dcb/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6b726973656c6c2f6c61726176656c2d73657373696f6e2d6d69677261746f722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/krisell/laravel-session-migrator)[![Total Downloads](https://camo.githubusercontent.com/ec811d095f21d34d5b5ab23b302d6b10f2cc8e65d551af394ef2a269609292b3/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6b726973656c6c2f6c61726176656c2d73657373696f6e2d6d69677261746f722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/krisell/laravel-session-migrator)[![GitHub Actions](https://github.com/krisell/laravel-session-migrator/actions/workflows/main.yml/badge.svg)](https://github.com/krisell/laravel-session-migrator/actions/workflows/main.yml/badge.svg)

Migrate Laravel session driver or serialization method in production without dropping sessions.

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

[](#installation)

```
composer require krisell/laravel-session-migrator
```

Features
--------

[](#features)

This package allows production applications to update some of the session configuration without dropping any active sessions and signing users out. More specifically, two session configuration options can be migrated:

1. Session serialization method (`php` or `json`), regardless of driver

    Laravel 9 introduced the option to serialize session data using `json` rather than php's `serialize`, and might be preferred both from a security perspective and performance-wise. The method is changed by specifying `'serialization' => 'json'` in `config/session.php`, but changing that in a production app would normally cause all active sessions to be invalidated and users to be signed out. With this package, this setting can be migrated transparently to users.
2. Session driver (from `file` or `cookie`)

    This package also allows to define a driver being migrated from, such that a new driver can be used without dropping any session data (technically, the old driver is used as a fallback `read` source, but all `writes` are performed against the new driver).

    Note that currently, only the `file` and `cookie` drivers are supported as being migrated *from*.

Usage
-----

[](#usage)

Installing the package intentionally doesn't activate any of the migration features. In order to perform a migration, update the session configuration to the new wanted settings, and then also perform one of the following:

- Add the following entry to your `config/session.php` file:

```
'migrate' => [
    'serialization' => true, // Enables transparent serialization method migration
    'driver' => 'file' // Session driver you are migrating from
],
```

- Alternatively, you can set the following two environment variables:

```
SESSION_MIGRATE_SERIALIZATION=true
SESSION_MIGRATE_DRIVER=file

```

You can of course choose to only use the serialization migration, or only the driver migration. It should be very rare that one need to migrate both these at the same time, although that is also supported.

Note specifically that `migrate.driver` is the driver you are migrating *from*, i.e. the previously used driver. The new driver or serialization method is configured just as normal, in the config file or environment variables.

You only need this package during a short transition period where your application might still have session data using the old format. The length of this depends on your session lifetime. As an example, if your session expires after 2 hours, you only need to run this package in production for those two hours, although keeping it around longer does no harm. For performance reasons, you should certainly disable and preferable remove this package eventually after the transition has been completed.

Pre-production applications
---------------------------

[](#pre-production-applications)

There is no reason to use this package in pre-production applications or local environments, execept of course for testing before using live. If dropping sessions doesn't matter in your use case, simply update the session configuration as normal and skip this package.

### Testing

[](#testing)

```
composer test
```

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

### Security

[](#security)

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

Credits
-------

[](#credits)

- [Martin Krisell](https://github.com/krisell)
- [All Contributors](../../contributors)

License
-------

[](#license)

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

Laravel Package Boilerplate
---------------------------

[](#laravel-package-boilerplate)

This package was generated using the [Laravel Package Boilerplate](https://laravelpackageboilerplate.com).

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity57

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

4

Last Release

1512d ago

Major Versions

v0.3.0 → v1.0.02022-03-22

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/25909128?v=4)[Martin Sandström Krisell](/maintainers/Krisell)[@Krisell](https://github.com/Krisell)

---

Top Contributors

[![Krisell](https://avatars.githubusercontent.com/u/25909128?v=4)](https://github.com/Krisell "Krisell (22 commits)")

---

Tags

laravellaravel-frameworkkriselllaravel-session-migrator

###  Code Quality

TestsPHPUnit

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/krisell-laravel-session-migrator/health.svg)

```
[![Health](https://phpackages.com/badges/krisell-laravel-session-migrator/health.svg)](https://phpackages.com/packages/krisell-laravel-session-migrator)
```

###  Alternatives

[barryvdh/laravel-ide-helper

Laravel IDE Helper, generates correct PHPDocs for all Facade classes, to improve auto-completion.

14.9k123.0M687](/packages/barryvdh-laravel-ide-helper)[orchestra/canvas

Code Generators for Laravel Applications and Packages

21017.2M158](/packages/orchestra-canvas)[illuminate/pipeline

The Illuminate Pipeline package.

9446.6M213](/packages/illuminate-pipeline)[illuminate/pagination

The Illuminate Pagination package.

10532.5M862](/packages/illuminate-pagination)[spatie/laravel-pjax

A pjax middleware for Laravel 5

513371.8k11](/packages/spatie-laravel-pjax)[spatie/laravel-mix-preload

Add preload and prefetch links based your Mix manifest

169176.0k2](/packages/spatie-laravel-mix-preload)

PHPackages © 2026

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