Download the PHP package ongudidan/laravel-multi-2fa without Composer

On this page you can find all versions of the php package ongudidan/laravel-multi-2fa. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-multi-2fa

Laravel Multi-Method Two-Factor Authentication (ongudidan/laravel-multi-2fa)

A complete, production-ready Two-Factor Authentication (2FA) package for Laravel applications supporting Inertia.js (Vue/React), Blade (Livewire/Alpine/HTML), and Headless JSON APIs.

This package provides a unified layer handling all three modern 2FA channels:

  1. Passkeys (WebAuthn / FIDO2): Fast, passwordless biometric authentication (Touch ID, Face ID, YubiKey, Windows Hello).
  2. Authenticator App (TOTP): Industry-standard 6-digit codes generated by Google Authenticator, Authy, Microsoft Authenticator, 1Password, etc.
  3. Email OTP: Single-use, timed 6-digit verification codes sent directly to the user's registered email address.
  4. Smart Login Challenge Selection: Automatically detects active methods per user and prompts them with a verification method selection screen when multiple channels are available.

🎨 Supported Frontend Stacks


Requirements


🤖 AI Agent Implementation Prompt

When integrating this package into any new or existing Laravel project (Inertia or Blade), copy and paste this concise prompt directly into your AI coding assistant (Antigravity, Cursor, Claude Code, Copilot, or ChatGPT):


Setup & Integration Guide

Step 1: Install Package & Dependencies

If developing locally or using a path repository, register packages/ongudidan/laravel-multi-2fa in your composer.json repositories first:

Install the package via Composer:

If using Inertia.js (Vue/React):

(Blade projects do not require @laravel/passkeys because built-in vanilla WebAuthn scripts are included).


Step 2: Publish Assets & Run Migrations

  1. Publish the configuration:

  2. Publish UI views based on your stack:

    • For Inertia.js (Vue 3):

    (Publishes EmailOtpLogin.vue, LoginChallengeSelection.vue, TwoFactor.vue, Passkeys.vue)

  1. Run migrations:

Step 3: Configure User Model

In app/Models/User.php, implement PasskeyUser and attach the 2FA traits:


Step 4: Configure Fortify Pipeline

In app/Providers/FortifyServiceProvider.php, plug the package's pipeline actions into Fortify::authenticateThrough:


Step 5: Share Security Settings in Inertia (Inertia Projects Only)

In app/Http/Middleware/HandleInertiaRequests.php, share the security settings with your frontend components:


Step 6: Route Protection Middleware (Optional)

To prevent users from navigating to two-factor configuration routes when globally disabled in system settings:

In your routing bootstrap (bootstrap/app.php in Laravel 11/12):


Configuration (config/multi-2fa.php)


How It Works at Runtime

  1. User enters email & password on /login.
  2. RedirectIfEmailOtpRequired validates credentials and queries TwoFactorService::getAvailableMethodsForUser($user).
  3. Smart Routing:
    • Multiple methods available (e.g. user has Passkey + Email OTP, or Authenticator + Email OTP):
      • User is redirected to /login-challenge-selection to pick their preferred method.
    • Only Email OTP available:
      • Code is generated, emailed, and user is redirected directly to /email-otp-login.
    • Only Authenticator App active:
      • Pipeline falls through to RedirectIfTwoFactorAuthenticatable which redirects to /two-factor-challenge.
    • No 2FA configured for this user:
      • Normal login completes instantly without prompts.
  4. Method Switching:
    • While on the Email OTP or Authenticator screens, if the user has alternate methods, a "← Choose a different verification method" option is shown allowing seamless switching.

License

The MIT License (MIT). Developed by Ongudidan.


All versions of laravel-multi-2fa with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
illuminate/support Version ^11.0|^12.0|^13.0
illuminate/contracts Version ^11.0|^12.0|^13.0
illuminate/http Version ^11.0|^12.0|^13.0
illuminate/routing Version ^11.0|^12.0|^13.0
illuminate/session Version ^11.0|^12.0|^13.0
illuminate/mail Version ^11.0|^12.0|^13.0
laravel/fortify Version ^1.20|^1.30|^1.40|^1.41
laravel/passkeys Version ^0.1|^0.2
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package ongudidan/laravel-multi-2fa contains the following files

Loading the files please wait ...