PHPackages                             juriandamen/laramultiauth-v2 - 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. juriandamen/laramultiauth-v2

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

juriandamen/laramultiauth-v2
============================

Multi Authentication for Laravel

0.2.0(6y ago)0290MITPHPPHP &gt;=7.1CI failing

Since Jan 8Pushed 6y ago1 watchersCompare

[ Source](https://github.com/JurianDamen/LaraMultiAuthV2)[ Packagist](https://packagist.org/packages/juriandamen/laramultiauth-v2)[ RSS](/packages/juriandamen-laramultiauth-v2/feed)WikiDiscussions master Synced yesterday

READMEChangelog (1)Dependencies (14)Versions (2)Used By (0)

LaraMultiAuth
=============

[](#laramultiauth)

[![Build Status](https://camo.githubusercontent.com/3624b82b7ad6f9aa89efb39d745c54a91387f403bc309af4bfa0ff723bf02135/68747470733a2f2f7472617669732d63692e6f72672f52537065656b656e6272696e6b2f4c6172614d756c7469417574682e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/RSpeekenbrink/LaraMultiAuth)[![Latest Stable Version](https://camo.githubusercontent.com/f9388b862cdf064aaf82b23c43c50796947820be93860a2cecdb0c27774cb02e/68747470733a2f2f706f7365722e707567782e6f72672f72737065656b656e6272696e6b2f6c6172616d756c7469617574682f76657273696f6e)](https://packagist.org/packages/rspeekenbrink/laramultiauth)[![License](https://camo.githubusercontent.com/a6d32604db6b92a03991ea0d9d354cf6e709b5ce0a509f649971a42f398208b5/68747470733a2f2f706f7365722e707567782e6f72672f72737065656b656e6272696e6b2f6c6172616d756c7469617574682f6c6963656e73652e706e67)](LICENSE)

LaraMultiAuth aims to provide the easiest interfaces and hooks to add Multi Factor Authentication to your Laravel Application.

Requirements
------------

[](#requirements)

- PHP &gt;= 7.1
- Laravel Framework &gt;= 5.6.0

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

[](#installation)

Require this package with composer.

```
composer require rspeekenbrink/laramultiauth
```

Since Laravel 5.5 Package Auto-Discovery exists so it doesn't require you to add the ServiceProvider to your app config anymore.

If you don't use auto-discovery, add the SerivceProvider to the providers array in config/app.php

```
RSpeekenbrink\LaraMultiAuth\ServiceProvider::class,
```

If you want to use the LaraMultiAuth facade, add this to your facades in app.php:

```
'LaraMultiAuth' => RSpeekenbrink\LaraMultiAuth\Facade::class
```

Copy the views and migration to your local application with the publishing command:

```
php artisan vendor:publish --provider="RSpeekenbrink\LaraMultiAuth\ServiceProvider"
```

Then run the migrations by executing the following command:

```
php artisan migrate
```

If you haven't already, make the default laravel Auth with the following command:

```
php artisan make:auth
```

Then to the LoginController.php add the following function:

```
use RSpeekenbrink\LaraMultiAuth\LaraMultiAuth;

...

/**
 * The user has been authenticated.
 *
 * @param  Request $request
 * @param  mixed  $user
 * @return mixed
 */
public function authenticated(Request $request, $user)
{
    return LaraMultiAuth::handle($request, $user);
}
```

And add the HasTOTPAuth trait to your User model:

```
use RSpeekenbrink\LaraMultiAuth\HasTOTPAuth;

...

class User extends Authenticatable
{
    use HasTOTPAuth;
```

And register the routes by adding this to routes/web.php:

```
\RSpeekenbrink\LaraMultiAuth\LaraMultiAuth::routes();
```

Usage
-----

[](#usage)

### Routes

[](#routes)

MethodRouteControllerDescriptionGET/login/multiauth\\RSpeekenbrink\\LaraMultiAuth\\Http\\Controllers\\TOTPController@showTokenScreenShow the multi authentication login screenPOST/login/multiauth\\RSpeekenbrink\\LaraMultiAuth\\Http\\Controllers\\TOTPController@verifyTokenVerify posted token from multi authentication login screenGET/multiauth/setup\\RSpeekenbrink\\LaraMultiAuth\\Http\\Controllers\\TOTPController@showSetup(Requires user to be logged in) Shows screen to setup TOTP AuthenticationPOST/multiauth/setup\\RSpeekenbrink\\LaraMultiAuth\\Http\\Controllers\\TOTPController@postSetup(Requires user to be logged in) Verifies and sets up TOTP Authentication for userPOST/multiauth/disable\\RSpeekenbrink\\LaraMultiAuth\\Http\\Controllers\\TOTPController@disableMultiAuth(Requires user to be logged in) Disable TOTP Authentication for user### Disabling on Runtime

[](#disabling-on-runtime)

To disable Multi Auth you can always call `LaraMultiAuth::disable()` before the handle function.

### Set custom redirect route

[](#set-custom-redirect-route)

You can set the route users will get redirected to after login by calling:

```
LaraMultiAuth::setRedirectPath('/dashboard')
```

where the `/dashboard` part is the path to redirect to.

### Generating QR-Codes

[](#generating-qr-codes)

For setting up TOTP authentication its often handy to be able to scan QR codes containing the secret than having to retype the secret on your device. This is easily achieveable, all you need is the [Bacon QR Code Package](https://github.com/Bacon/BaconQrCode) (&gt; v2.0.0) and the [Imagick](https://www.php.net/manual/en/book.imagick.php) php extension. Once this package is installed the setup controller will automatically pass an inline QR code src to the setup view.

### Custom Routes/Controller

[](#custom-routescontroller)

Ofcourse it's possible to create your own routes and controllers. For that simply set the route for token verification via:

```
LaraMultAuth::setTOTPRoute('your.route.name');
```

Source for verifying tokens and setting/removing tokens can be found in the [TOTPController](src/Http/Controllers/TOTPController.php).

Testing
-------

[](#testing)

After installing the composer dev requirements the application can be tested by executing the following command from the project root directory:

```
vendor/bin/phpunit
```

Todo
----

[](#todo)

There is still a lot to be done for this package. The aim for this package is to add multiple ways of multi authenticating your users. Now it only has the TOTP service available which allows users to enable Multi Authentication with an app like Google Authenticator or Authy. Future plans are to extend the package to support SMS services aswell and to make the implementation of Multi Authentication even easier for developers.

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

2316d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/67068e172ee3f821b7b0e5836ecb1c89aa5ee78841b0ab5bbcbcffb9440f250f?d=identicon)[JurianDamen](/maintainers/JurianDamen)

---

Top Contributors

[![JurianDamen](https://avatars.githubusercontent.com/u/49483310?v=4)](https://github.com/JurianDamen "JurianDamen (4 commits)")

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/juriandamen-laramultiauth-v2/health.svg)

```
[![Health](https://phpackages.com/badges/juriandamen-laramultiauth-v2/health.svg)](https://phpackages.com/packages/juriandamen-laramultiauth-v2)
```

###  Alternatives

[laravel/passport

Laravel Passport provides OAuth2 server support to Laravel.

3.4k85.0M532](/packages/laravel-passport)[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

9682.1M97](/packages/roots-acorn)[laravel/pulse

Laravel Pulse is a real-time application performance monitoring tool and dashboard for your Laravel application.

1.7k12.1M99](/packages/laravel-pulse)[larastan/larastan

Larastan - Discover bugs in your code without running it. A phpstan/phpstan extension for Laravel

6.4k43.5M5.2k](/packages/larastan-larastan)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

255.2k](/packages/aedart-athenaeum)[laravel/mcp

Rapidly build MCP servers for your Laravel applications.

71510.9M66](/packages/laravel-mcp)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
