Looking to hire Laravel developers? Try LaraJobs

laravel-jwt-auth maintained by plugins-world

Description
LaravelJwtAuth plugin made by mouyong
Author
Last update
2025/05/13 19:05 (dev-master)
License
Links
Downloads
0

Comments
comments powered by Disqus

LaravelJwtAuth

Latest Stable Version Total Downloads Latest Unstable Version License PHP Version Require

This is where your description should go. Try and limit it to a paragraph or two, and maybe throw in a mention of what PSRs you support to avoid any confusion with users and contributors.

Installation

You can install the package via composer:

php artisan market:require plugins-world/laravel-jwt-auth

composer require plugins-world/laravel-jwt-auth

Usage

单独使用登录功能时,请在 auth()->login() 时使用 Plugins\LaravelJwtAuth\Models\User,示例如下:

use Plugins\LaravelJwtAuth\Models\User as JwtModelUser;

$inputPassword = \request('password');

$user = \App\Models\User::first();
if (Hash::check($user->password, $inputPassword)) {
    // get_class($user) !== config('auth.providers.api.model') 配置的模型时,
    // 需要将 $user 转换成配置的模型。后续验证才能通过登录验证。
    $token = auth('api')->login(new JwtModelUser($user->toArray()));
}

Testing

composer test

How to create this package

php artisan new LaravelJwtAuth

Please see plugin-manager for more information.