mideal / laravel-jwt
该软件包最新版本(1.0.1)没有可用的许可证信息。
Jwt认证用于Laravel
1.0.1
2023-04-05 22:19 UTC
Requires
- php: ^8.0.2
- firebase/php-jwt: ^6.4
- illuminate/auth: ^10.0
- illuminate/config: ^10.0
- illuminate/contracts: ^10.0
- illuminate/http: ^10.0
- illuminate/support: ^10.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.16
- mockery/mockery: ^1.5
- phpstan/phpstan: ^1.10
- phpunit/phpunit: ^10.0
README
Laravel Jwt为单页面应用(SPAs)和API提供了一个基于jwt的认证系统。
安装
您可以通过Composer包管理器安装Laravel Jwt
composer require mideal/laravel-jwt
接下来,您应该使用vendor:publish Artisan命令发布Jwt配置文件。Jwt配置文件将放置在您的应用程序的config目录中
php artisan vendor:publish --provider="Mideal\Jwt\JwtServiceProvider"
保护路由
use Illuminate\Http\Request; Route::middleware('auth:jwt')->get('/user', function (Request $request) { return $request->user(); });