tomgrohl / laravel-memory-auth-provider
Laravel 内存认证提供者。
1.0.1
2018-01-29 20:34 UTC
Requires
- laravel/laravel: ^5.1
Requires (Dev)
- phpunit/phpunit: ~4.0|~5.7
This package is auto-updated.
Last update: 2024-09-14 07:04:52 UTC
README
Laravel 内存认证提供者
为 Laravel 5.1+ 提供内存用户认证提供者。
允许您在没有数据库的情况下认证和管理区域。作为开发过程中的快速临时解决方案非常不错,尤其是当您的网站是模拟的且不使用数据库时。
安装
您可以使用 composer 安装它
composer require tomgrohl/laravel-memory-auth-provider
配置
1. 添加服务提供者
将以下内容添加到您的 app
配置文件中的 providers
<?php return [ //... 'providers' => [ //... 'Tomgrohl\Laravel\Auth\AuthServiceProvider', // OR \Tomgrohl\Laravel\Auth\AuthServiceProvider::class, ] ];
2. 配置设置
在 auth
配置中,您需要设置驱动程序
'driver' => 'memory',
同时设置您的内存用户
'memory' => [
'model' => 'Illuminate\Auth\GenericUser',
'users' => [
'admin' => [
'id' => 1,
// Hashed passord using the hasher service
'password' => '$2y$10$Mfusxb1546MFxQ4A1s4GE.OF/gFuI8Y6Hw9xnlZeiHtjDl0/pnXPK',
],
],
],
您可以添加任何属性,使其容易切换认证驱动程序。
该包包含一个用于散列密码的命令,使设置密码更加容易,只需运行以下命令来散列您的密码
php artisan tomgrohl:hash:password mypassword