My Blog Posts

Laravel JWT Redis Pack

Laravel JWT Redis Pack


Laravel JWT Redis allows JWT-approved users to store and manage roles, permissions, status, and other data in Redis. tymondesigns /jwt-auth and works together with spatie/laravel-let pack.

You configure authorization as follows provided by the package:

'guards' => [
'api' => [
'driver' => 'jwt_redis_guard',
'provider' => 'users'
],
],
'providers' => [
'users' => [
'driver' => 'jwt_redis_user_provider',
'model' => App\User::class, /* Your User Model */
],
],

Here are several examples of route usage:

Route::get("/example", "ExampleController@example")-middleware('role:admin|user');
Route::get("/example", "ExampleController@example")-middleware('permissions:get-user|set-user');
Route::get("/example", "ExampleController@example")-middleware('role_or_permission:admin|get-user');

This package is new during writing, so I suggest you check the source code. ,

You can learn more about this package, get full installation instructions, and view the source code on GitHub at sametsahindogan /laravel-jwtredis.



Share this article


Comments (0)

Comment