customergauge/session

Native PHP Session adapter for Laravel Authentication
41,471 9
Install
composer require customergauge/session
Latest Version:2.3.0
PHP:>=8.1
Laravel:7 – 13
License:MIT
Last Updated:Sep 7, 2026
Links: GitHub  ·  Packagist
Maintainer: Deleu

Code Coverage Scrutinizer Code Quality

Laravel PHP Session ⛔

This library provides a NativeSessionUserProvider for Laravel.

Installation

composer require customergauge/session

Usage

Auth configuration

In the auth.php file, add the following settings:

Default Guard

    'defaults' => [
        'guard' => 'php',
        'passwords' => 'users',
    ],

The new Guard configuration

    'guards' => [
        'php' => [
            'driver' => \CustomerGauge\Session\NativeSessionGuard::class,
            'provider' => \CustomerGauge\Session\NativeSessionUserProvider::class,
            'domain' => '.app.mydomain.com',
            'storage' => 'tcp://my.redis.address:6379',
        ],
    ],

Auth Middleware

Configure the auth middleware at App\Http\Kernel with 'auth:php'

UserFactory

The last thing you'll need is to provide your own implementation of UserFactory and register it in a ServiceProvider.

final class NativeSessionUserFactory implements UserFactory
{
    public function make(array $session): ?Authenticatable
    {
        // $session here is the same as $_SESSION
        
        return new MyUserObject(
            $session['id'],
            $session['my_user_attribute'],
        );
    }
}

In the provider:

$this->app->bind(CustomerGauge\Session\Contracts\UserFactory, App\Auth\NativeSessionUserFactory::class);

Related Packages

bebbolus/elsquerybuildertrait

ElasticSearch Query Builder for Laravel PHP Framework

58 0
bebbolus/elasticsessions

ElasticSearch Sessions Driver for Laravel PHP Framework

54 1
dusterio/laravel-google-guard

Auth guard for Laravel that completely relies on Google Login and doesn't persis...

350 6
codezero/session

Manage session data.

2,821 0
bebbolus/elsrepositorytrait

PHP trait to manage the Laravel Entity on ElasticSearch via Elastiquent

60 1

Version History

Version Released PHP Laravel License
2.3.0 >=8.1 >=7.28 MIT
2.2.1 >=8.1 >=7.28 MIT
2.2.0 >=7.3 >=7.28 MIT
2.1.0 >=7.3 ^7.28 || ^8.0 || ^9.0 MIT
2.0.0 >=7.3 ^7.28 || ^8.0 MIT