Description
Laravel OTP is a small package for generating and validating one-time passwords in a Laravel application. It is meant mostly for authentication flows, such as confirming a sign-in or a sign-up with a short code. You install it with Composer and then run its migrations to create the table that stores the tokens. To generate a code, you give an identifier that the code is tied to, a type of numeric or alpha_numeric, an optional length that defaults to 4 characters, and an optional validity period that defaults to 10 minutes. To validate a code, you pass the identifier and the token. The response says whether the token succeeded, does not exist, is not valid or has expired. An isValid method checks a code without marking it as used. The package also includes a way to delete expired tokens. The README notes that responses come back as objects, which you read with the arrow operator.…
Highlights
- Generate numeric or alphanumeric one-time codes
- Set code length and validity in minutes
- Validate codes with clear success and failure responses
- Check validity without consuming the code
- Delete expired tokens
Ratings & Reviews
No ratings yet
Be the first to rate Laravel Otp.
People also visit
Otpauth
Implements two-step verification of HOTP/TOTP. Also known as one time password
Laravel Otp FAQ
What is Laravel OTP used for?
It generates one-time passwords and checks them in a Laravel app, mainly for authentication such as verification codes.
How do I install it?
Install the package with Composer, then run the migrations so the table for the tokens is created.
How long does a code last?
By default a code is valid for 10 minutes. You can set a different validity period when you generate it, in minutes.
What do the validation responses mean?
The README lists four outcomes: success, does not exist, not valid, and expired. Each one comes back as an object.
Is it free?
The source is public on GitHub. The README does not state a price or a license.
What are the best Laravel Otp alternatives?
Popular alternatives to Laravel Otp include Google2fa Laravel, Otpauth and Otplib. See all Laravel Otp alternatives



