PHPackages                             p1613m/laravel-tokens - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Authentication &amp; Authorization](/categories/authentication)
4. /
5. p1613m/laravel-tokens

ActiveLibrary[Authentication &amp; Authorization](/categories/authentication)

p1613m/laravel-tokens
=====================

Multi-token support for Laravel Auth.

01481PHP

Since Apr 26Pushed 6y ago1 watchersCompare

[ Source](https://github.com/p1613m/laravel-tokens)[ Packagist](https://packagist.org/packages/p1613m/laravel-tokens)[ RSS](/packages/p1613m-laravel-tokens/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependenciesVersions (1)Used By (0)

Laravel Multi Token
===================

[](#laravel-multi-token)

[![Latest Version on Packagist](https://camo.githubusercontent.com/d96e20d3ff461f0620557e780097422421afd18c8bdd1a5ee554507863b35895/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6d61796f7a2f6c61726176656c2d746f6b656e732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/mayoz/laravel-tokens)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Quality Score](https://camo.githubusercontent.com/2219faf9d079a702a207f7f568857a6eb4c4660f51446e4cedabbef6f3c32cd8/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f6d61796f7a2f6c61726176656c2d746f6b656e732e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/mayoz/laravel-tokens)[![StyleCI](https://camo.githubusercontent.com/b539c33232cbdc80a0cc3a3dc901b2f6d90d373c53c773caec478e6382b366e6/68747470733a2f2f7374796c6563692e696f2f7265706f732f3132323736373631312f736869656c643f6272616e63683d6d6173746572)](https://styleci.io/repos/122767611)[![Total Downloads](https://camo.githubusercontent.com/d7feeafffcf297661e3425f523e769639b9b4f544cbb8e566175e4942816d95b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6d61796f7a2f6c61726176656c2d746f6b656e732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/mayoz/laravel-tokens)

Introduction
------------

[](#introduction)

This package provides a simple solution for give multiple token to your application's users. This solution is similar to Laravel's TokenGuard class.

This package is for Laravel 5.5 and above.

Installation
------------

[](#installation)

You can install the package via composer using:

```
composer require mayoz/laravel-tokens

```

The service provider will automatically get registered for Laravel 5.5 and above versions. If you want you can add the service provider in `config/app.php` file:

```
'providers' => [
    // ...
    Mayoz\Token\TokenServiceProvider::class,
];
```

If you are going to make changes the default migration, you can publish the `migration` file with:

```
php artisan vendor:publish --provider="Mayoz\Token\TokenServiceProvider" --tag="laravel-tokens-migrations"

```

Then, you can create the `tokens` table by running the migrations:

```
php artisan migrate

```

You can publish the config file with:

```
php artisan vendor:publish --provider="Mayoz\Token\TokenServiceProvider" --tag="laravel-tokens-config"

```

If you need you are free to change your `config` file.

Implementation
--------------

[](#implementation)

After installation, you can implement the new feature for your application.

Add the `Mayoz\Token\HasToken` trait to your `App\User` model. This trait will provide a few helper methods to your model which allow you to inspect the authenticated user's tokens:

```
