New

Just launched: Vueblocks, a brand-new search engine for Vue packages! Explore Vueblocks →

digit-soft/laravel-token-auth

Laravel token auth cached.
3,848 3
Install
composer require digit-soft/laravel-token-auth
Latest Version:2.3.4
PHP:^8.1
Laravel:7 – 13
Older releases:5 · 6
License:MIT
Last Updated:Apr 8, 2026
Links: GitHub  ·  Packagist
Maintainer: digitv

Token auth for Laravel 7+

Component uses Redis to store token information

Install

composer require "digit-soft/laravel-token-auth:~1.0"

Publish config

php artisan vendor:publish --provider="DigitSoft\LaravelTokenAuth\AuthServiceProvider" --tag=config

Configure guard

Change driver to token-cached in config/auth.php

    'guards' => [
        ...
        'api' => [
            'driver' => 'token-cached',
            'provider' => 'users',
        ],
        ...
    ],

Ships with multiple middleware

  • DigitSoft\LaravelTokenAuth\Middleware\DefaultAuthGuard - set default auth guard to given value
  • DigitSoft\LaravelTokenAuth\Middleware\DefaultSessionDriver - set default session driver to given value
  • DigitSoft\LaravelTokenAuth\Middleware\AddGeneratedTokenToResponse - adds token generated during request to response header Some middleware useful for PHP-PM driven applications.

Sessions

There is possibility to save session data to token, if you will use package session handler DigitSoft\LaravelTokenAuth\Session\TokenSessionHandler, driver name is token-cached. You can also set it with DefaultSessionDriver middleware. Often rewritable data such as previous page, flashes and _token are not stored.

Events

There is DigitSoft\LaravelTokenAuth\Events\AccessTokenCreated, which fired every time token is created by TokenCached facade. So you can write or check information in AccessToken with own event listener.

Customization

  • You can use your own AccessToken implementation by extending original class and set its name in config.
  • You can set your own header name for AddGeneratedTokenToResponse middleware in config.

You can find more options and description in config file.

Related Packages

masim-appcrates/laravel-authentication

My Custome Laravel Authentication

6 0
laravel/fortify

Backend controllers and scaffolding for Laravel authentication.

71,007,039 1,760
laravel/breeze

Minimal Laravel authentication scaffolding with Blade and Tailwind.

44,690,117 3,058
devdojo/auth

The auth package to make authentication in your laravel applications easy to use...

272,507 621
ems/permit

Permission based authentication system

8,852 0

Version History

Version Released PHP Laravel License
2.3.4 ^8.1 ^7.30.6||^8.75||^9.1.9||^10.0||^11.0||^12.0||^13.0 MIT
2.3.3 ^8.1 ^7.30.6||^8.75||^9.1.9||^10.0||^11.0||^12.0||^13.0 MIT
2.3.2 ^8.0 ^7.30.6||^8.75||^9.1.9||^10.0||^11.0||^12.0 MIT
2.3.0 ^8.0 ^7.30.6||^8.75||^9.1.9||^10.0||^11.0 MIT
2.2.0 ^8.0 ^7.30.6||^8.75||^9.1.9||^10.0 MIT