customergauge/session
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
dusterio/laravel-google-guard
Auth guard for Laravel that completely relies on Google Login and doesn't persis...
350
6
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 | | MIT | |
| 2.0.0 | >=7.3 | ^7.28 | | MIT | |
| 1.5.0 | >=7.3 | ^7.28 | | MIT | |
| 1.4.0 | >=7.3 | ^7.28 | | MIT | |
| 1.3.0 | >=7.3 | ^7.28 | | MIT | |
| 1.2.0 | >=7.3 | ^7.28 | | MIT | |
| 1.1.0 | ^7.3 | ^7.28 | | MIT | |
| 1.0.0 | ^7.3 | ^7.28 | MIT |

