Download the PHP package benbjurstrom/otpz without Composer

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

OTPz Screenshot

First Factor One-Time Passwords for Laravel

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status

This package provides secure first factor one-time passwords (OTPs) for Laravel applications. Users enter their email and receive a one-time code to sign in—no passwords required.

Features


Quick Start

Prerequisites

OTPz works best with the official Laravel starter kits:

OTPz's frontend components are designed to work out of the box with the Laravel starter kits and make use of their existing UI components (Button, Input, Label, etc.). Because these components are installed into your application you are free to customize them for any Laravel application using React, Vue, or Livewire.


Installation

1. Install the Package

2. Run Migrations

3. Add Interface and Trait to User Model


Framework-Specific Setup

Choose your frontend framework:

React (Inertia.js)

1. Publish Components

This copies the following files to your application:

Note: These components import shadcn/ui components (Button, Input, Label, Checkbox), layout components (AuthLayout), and use wayfinder for route generation from the Laravel React starter kit. If you're not using the starter kit, you may need to adjust these imports or create these components.

2. Add Routes

Add to routes/web.php:

That's it! The controller handles all the OTP logic for you.


Vue (Inertia.js)

1. Publish Components

This copies the following files to your application:

Note: These components import layout components (AuthLayout), and use wayfinder for route generation from the Laravel Vue starter kit. If you're not using the starter kit, you may need to adjust these imports or create these components.

2. Add Routes

Add to routes/web.php:

That's it! The controller handles all the OTP logic for you.


Livewire (Volt)

1. Publish Components

This copies the following files to your application:

Note: These Volt components use Flux UI components and layout components from the Laravel Livewire starter kit. If you're not using the starter kit, you may need to adjust the component markup and styling.

2. Add Routes

Add to routes/web.php:


Replacing Fortify Login (Optional)

The latest Laravel starter kits use Laravel Fortify for authentication. If you want to replace the default username/password login with OTPz:

For React:

In app/Providers/FortifyServiceProvider.php, update the loginView method:

For Vue:

In app/Providers/FortifyServiceProvider.php, update the loginView method:

For Livewire:

In app/Providers/FortifyServiceProvider.php, comment out the default login view:

Then in routes/web.php, update the OTPz route to use login:

Now when users visit /login or are redirected to the login page, they'll see the OTPz email entry form instead of the traditional username/password form.


Configuration

Publish Configuration File (Optional)

This is the contents of the published config file:

7. (Optional) Publish the translations file

This package publishes the translations file:


Customization

Email Templates

Publish the email templates to customize styling:

This publishes:

Switch between templates in config/otpz.php:

Custom User Resolution

By default, OTPz creates new users when an email doesn't exist. You can customize this behavior by creating your own user resolver and registering it in the config. In this example we throw a validation error if a user with the given email address does not exist.

Update config/otpz.php:


Testing


Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.


All versions of otpz with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
spatie/laravel-package-tools Version ^1.16
illuminate/contracts Version ^10.0||^11.0||^12.0||^13.0
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 benbjurstrom/otpz contains the following files

Loading the files please wait ...