An In Memory User Auth Provider for Laravel 9+.
Allows you to Authenticate an admin area without the need for a database. Great as a quick and temporary solution during development, particularly if your site is mocked out and not let using a database.
- PHP 8.0.2+
- Laravel 9.0+
To install this package please run:
composer require smashed-egg/laravel-in-memory-auth
Do you like this package? Does it improve you're development. Consider sponsoring to help with future development.
Thank you!
In the auth.php
config file you will need to set the driver:
'driver' => 'memory',
Add also setup your in memory users:
'memory' => [
'driver' => 'memory',
'model' => \SmashedEgg\LaravelInMemoryAuth\User::class,
'username_field' => 'email',
'users' => [
/*
'me@email.com' => [
'id' => 1,
'name' => 'My name',
// Hashed password using the hasher service
'password' => 'hashed_password',
],
*/
'admin@example.com' => [
'id' => 1,
'email' => 'admin@example.com',
'name' => 'Barry Allen'
// Hashed password using the hasher service
'password' => '$2y$10$Mfusxb1546MFxQ4A1s4GE.OF/gFuI8Y6Hw9xnlZeiHtjDl0/pnXPK',
'remember_token' => '',
],
],
],
You can add any properties you want making it easy to switch out the Auth drivers.
The package comes with a command for hashing passwords, making it easier to setup passwords, just run the following command to hash your password:
php artisan smashed-egg:hash:password mypassword
Contributing is welcome. Please see our guide here.
This package is open-sourced software licensed under the MIT license.