Download the PHP package mkd/laravel-otp without Composer

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

Laravel OTP

Latest Version on Packagist Total Downloads GitHub Actions

A simple Laravel package for generating and verifying One-Time Passwords (OTPs) using TOTP (Time-based One-Time Password) and HOTP (HMAC-based One-Time Password) algorithms.

Installation

You can install the package via Composer:

Example

Scan This QR Code using Authenticator app

My Image

Here's a simple example demonstrating how to generate and verify an OTP:

Usage

Creating an Instance

You can create an instance of the LaravelOTP class by providing a secret key:

Public Methods

now(): string

Returns the current TOTP for the current timeframe.

last(): string

Returns the TOTP for the previous timeframe (30 seconds earlier).

next(): string

Returns the TOTP for the next timeframe (30 seconds later).

at(int $offset = 0): string

Returns the TOTP for a custom timeframe based on the provided offset. An offset of 0 returns the current TOTP, -1 returns the last OTP, and 1 returns the next OTP.

generateSecretKey(): string

Generates a new secret key.

atCounter(int $counter): string

Returns the HOTP for a specific counter value.

verifyTOTP(string $otp, string|null $secret = null): bool

Verifies a given TOTP against the current, previous, and next timeframes. If a secret key is provided, it overrides the current secret.

verifyHOTP(string $otp, int $counter, string|null $secret = null): bool

Verifies a given HOTP against a specific counter. If a secret key is provided, it overrides the current secret.

Google Authenticator Compatible

generateUrl(string $label, string $issuer, string $secretKey = null, int $counter = null): string

Generates an OTP Auth URL for use in generating a QR code. This URL can be used by OTP apps like Google Authenticator.

Usage Example:

License

This package is licensed under the MIT License. See the LICENSE file for more information.


All versions of laravel-otp with dependencies

PHP Build Version
Package Version
Requires php Version ^8.0
laravel/framework Version ^8.0|^9.0|^10.0|^11.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 mkd/laravel-otp contains the following files

Loading the files please wait ....