mostbyte / auth
来自身份服务的Mostbyte授权系统
3.1.2
2024-07-23 10:32 UTC
Requires
- php: ^8.2
- guzzlehttp/guzzle: ^7.8
- illuminate/contracts: ^11.0
- illuminate/database: ^11.0
- illuminate/support: ^11.0
Requires (Dev)
- orchestra/testbench: ^9.0
- phpunit/phpunit: ^11.0
README
来自身份服务的Mostbyte授权系统
版本
安装
要获取 Mostbyte auth 的最新版本,只需使用 Composer 需求项目即可
composer require mostbyte/auth
当然,您也可以手动更新require块并运行 composer update,如果您选择这样做的话
{
"require": {
"mostbyte/auth": "^3.0"
}
}
发布配置文件
php artisan vendor:publish --provider="Mostbyte\Auth\AuthServiceProvider"
警告:在生产环境中,在
.env中您应该指定LOCAL_DEVELOPMENT=false。否则,您所有的HTTP请求都将由faker处理
使用方法
在路由中使用
use Mostbyte\Auth\Middleware\IdentityAuth; Route::middleware(IdentityAuth::class)->get("foo", function () { return "bar"; });
或者在 App\Http\Kernel.php 中指定
protected $middlewareAliases = [ // other middlewares... "identity" => \Mostbyte\Auth\Middleware\IdentityAuth::class ];
并在路由中
Route::middleware('identity')->get("foo", function () { return "bar"; });