Description
TwoFactor is a PHP package for Laravel that adds two-factor authentication to the login flow of a Laravel app. It uses time-based one-time codes of 6 digits, which are generated and checked inside your own application, so there is no external API or SMS service to set up. You install it with Composer, run an Artisan command to publish the migration, translations, views and config, and then add a contract and a trait to your User model. After a password is accepted, the package can ask the user for a code before the login completes. It includes a ready-made view and a helper for that step. It works without extra middleware or new guards, though you can wire it up by hand if you prefer. The package needs PHP 8.3 or later and Laravel 12 or later. It is aimed at Laravel developers who want two-factor sign-in for their own users.…
Highlights
- 6-digit time-based codes with no external API
- Works with the normal login flow, no new guards needed
- Artisan command installs migration, views and config
- Set up with a QR code, otpauth URI or text string
- Requires PHP 8.3+ and Laravel 12+
Ratings & Reviews
No ratings yet
Be the first to rate TwoFactor.
People also visit
Totp RS
RFC-compliant TOTP implementation with ease of use as a goal and additionnal…
TwoFactor FAQ
Does it need a third-party service?
No. Codes are generated and checked inside your application, so there are no external APIs or SMS services to call.
What do I need to run it?
PHP 8.3 or later and Laravel 12 or later. You install the package with Composer.
How do users set it up?
Your app can show a QR code, an otpauth:// URI or a text string, which the user adds to an authenticator app.
Can I change the database table?
Yes. You can edit the migration to add columns or change the table name before you run it.
Is it open source?
The source is public on GitHub at Laragear/TwoFactor.
What are the best TwoFactor alternatives?
Popular alternatives to TwoFactor include 2fa, Authme and 2FAuth. See all TwoFactor alternatives



.png?auto=compress&fit=max&w=128)
