Download the PHP package kwidoo/passport-multiauth without Composer

On this page you can find all versions of the php package kwidoo/passport-multiauth. 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 passport-multiauth

Latest Version on Packagist Total Downloads GitHub Actions

Laravel Passport Multi-Auth

A Laravel package that extends Laravel Passport’s password grant to support multiple authentication methods (e.g., SMS/Email OTP). You can define custom OTP strategies and user resolvers in a single config file, making your OTP flows more flexible and secure.

Requirements


Installation

  1. Require via Composer:

    This automatically installs the package and its dependencies (except for the optional Twilio SDK mentioned above).

  2. Publish Config (optional):

    This copies passport-multiauth.php into your config folder, allowing you to adjust OTP strategies, timeouts, and more.

  3. Publish Migrations and Views (if desired):

    • Migrations will create (by default) an otps table to store OTP codes and status.
    • Views include basic Blade templates for OTP success/error states.
  4. Run Migrations:

    This will create any necessary tables (e.g., otps table for storing email OTPs).

  5. Configure Twilio (Optional): If using Twilio, define these in your .env or in a config/twilio.php:

    Note, you should have a Twilio account and will need to create Verification SID there. This code doesn't use regular SMS by default, but Twilio Verify API. For more details, see the Twilio Verify API.

Usage

  1. Request an OTP This package includes OTPController and a route file (routes.php) with a POST /oauth/otp endpoint by default. Package will respect changes in config/passport.php file. Example request:

    or:

    This triggers the corresponding service (e.g., TwilioService or EmailService) to generate/send OTP.

  2. Obtain Access Token After receiving the OTP, call the standard Passport token endpoint (often POST /oauth/token) with parameters:

    • If method = "twilio", the package will validate the OTP via Twilio.
    • If method = "email", it will use the email-based OTP.
    • If method is "password" or missing, it defaults to Laravel Passport’s normal password-based grant.
  3. Configuration File (config/passport-multiauth.php) You can customize each strategy like so:

    • class: The service that sends/validates the OTP (Twilio, Email, etc.).
    • strategy: Usually OTPStrategy, which handles how the credentials are validated using the class.
    • resolver: Defines how to find your user record after OTP validation (e.g., by email, phone).
  4. OTP model (Kwidoo\MultiAuth\Models\OTP)

    • This model is used on with Email strategy to store OTPs. Twilio doesn't require to store OTPs localy
    • You can customize one time password model by changing the otp.model key in the configuration file.

    • Default one time password is 6 digits long and expires in 5 minutes. You can change these values in the configuration file.

Example Flow

  1. User enters their phone number on your app.
  2. Your app calls POST /oauth/otp with { "method":"twilio", "username":"+1234567890" }.
  3. TwilioService (in the background) sends an SMS code via Twilio.
  4. User receives the code and enters it in your app.
  5. Your app calls POST /oauth/token with:

  6. MultiAuthGrant checks that the OTP is correct, then resolves the user from the database, and issues a Passport token.

Testing

Running Tests Locally

  1. Install dependencies & dev tools (like Orchestra Testbench):

  2. Run tests:

    or

  3. Generate coverage:

    This outputs an HTML coverage report in a coverage folder.

Contributing

License

MIT


All versions of passport-multiauth with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
laravel/passport Version ^12.0
kwidoo/sms-verification Version ^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 kwidoo/passport-multiauth contains the following files

Loading the files please wait ....