https://github.com/plugins-world/laraveljwtauth
https://github.com/plugins-world/laraveljwtauth
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/plugins-world/laraveljwtauth
- Owner: plugins-world
- Created: 2023-03-08T12:56:57.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2025-05-13T17:06:17.000Z (about 1 year ago)
- Last Synced: 2025-12-14T17:55:13.387Z (6 months ago)
- Language: PHP
- Size: 9.77 KB
- Stars: 0
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# LaravelJwtAuth
[](https://packagist.org/packages/plugins-world/laravel-jwt-auth)
[](https://packagist.org/packages/plugins-world/laravel-jwt-auth)
[](https://packagist.org/packages/plugins-world/laravel-jwt-auth) [](https://packagist.org/packages/plugins-world/laravel-jwt-auth)
[](https://packagist.org/packages/plugins-world/laravel-jwt-auth)
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:
```bash
php artisan market:require plugins-world/laravel-jwt-auth
composer require plugins-world/laravel-jwt-auth
```
## Usage
单独使用登录功能时,请在 `auth()->login()` 时使用 Plugins\LaravelJwtAuth\Models\User,示例如下:
```php
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
``` bash
composer test
```
### How to create this package
`php artisan new LaravelJwtAuth`
Please see [plugin-manager](https://github.com/plugins-world/plugin-manager) for more information.