liberusoftware/two-factor-authentication
A Laravel/PHP package from Liberu Software for adding two-factor authentication to your applications. It supports TOTP-based 2FA, QR code enrollment, recovery codes, and straightforward integration with existing user models and login flows.
What the package actually is. The description scopes it narrowly: TOTP enforcement policy plus one-time recovery-code primitives. That reads as a policy/decision layer (when 2FA is required, who is exempt, how enrollment gating works) and a recovery-code subsystem (generation, hashing, single-use redemption). It is very likely not a turnkey 2FA module — expect no login UI, no QR provisioning screens, no backup-channel orchestration. A TPM should plan for this to be one layer in a stack, not the feature itself.
Architecture fit. Laravel-native and shipped as a "module," which implies the author's own module loader/registry convention rather than plain package auto-discovery. That is the single biggest architectural question: if your application does not already use the Liberu module ecosystem, you are paying an integration tax to adopt someone else's plugin convention. The MIT license is permissive and compatible with commercial use, modification, and forking — favorable for the mitigation strategy below.
Integration feasibility. Recovery-code primitives are the highest-value, lowest-coupling part: hashing, storage, and invalidation semantics are self-contained and portable. Policy enforcement is more entangled — it must hook your auth pipeline (login, middleware, gates) and will need adapting to however your app models users and sessions. TOTP secret generation/verification is almost certainly delegated to an underlying library (likely pragmarx/google2fa or spomky-labs/otphp); confirm this before assuming you can avoid adding that dependency.
Technical risk. Material, and driven by maturity signals rather than code quality:
Key questions for the maintainer/source review.
encrypted cast / key rotation, or plaintext?Stack fit. Only a clean fit if you are already on Laravel and, ideally, inside the Liberu module ecosystem. On stock Laravel, budget for adapter work: service provider registration, config publishing, and wiring policy checks into your existing auth flow. If you use Fortify, Jetstream, Breeze, or Laravel's first-party 2FA scaffolding, clarify overlap first — the likeliest outcome is that this package duplicates some of it and complements the rest.
Recommended posture: vendor, don't depend. Given 0 dependents and a security-critical domain, do not add it as a floating Composer dependency. Fork or vendor the source into your repo (MIT permits this), pin the exact commit, and own the code. This converts abandonment risk from an outage risk into a maintenance cost — a trade you want here.
Migration path.
TwoFactorPolicy, RecoveryCodeService) and implement it with the package's primitives behind that seam. Every call site talks to your interface, never to the package directly. This makes replacement a one-file change.Compatibility and sequencing. Verify Laravel/PHP support matrix against your version before the spike — a mismatch here ends the evaluation cheaply. Sequence the recovery-code subsystem independently of the policy layer if possible; it is the lower-risk half and can ship value earlier. Defer any dependency on the module loader unless you're already committed to that ecosystem.
Fallback. Laravel Fortify plus a maintained TOTP library covers the same ground with far more production evidence. Keep this as the named alternative so the build-vs-buy conversation stays honest.
Maintenance. You are the maintainer. Assume upstream goes quiet. Practical burden: tracking Laravel major-version upgrades (every year or so), patching the vendored copy, and re-auditing when the underlying TOTP library ships security fixes. Estimate low-single-digit engineering days per year in steady state, plus one meaningful review at each Laravel major bump. That is acceptable — but it must be explicitly owned by a named engineer, not "the team."
Support. No community to lean on. Internal documentation is mandatory, not optional: enrollment flow, admin reset procedure, recovery-code issuance policy, and what to do when a user loses both device and codes. Your support desk needs a scripted, audited identity-verification path for 2FA resets — this is the operational failure that generates tickets, not the cryptography.
Scaling. Cryptographically trivial; verification is a few milliseconds and won't be your bottleneck. Real scaling concerns are operational: recovery-code regeneration storms after a phishing scare, and rate-limit state if throttling uses the cache or database. Confirm throttling storage is your shared cache, not per-node memory, or horizontal scaling silently weakens protection.
Failure modes to instrument.
APP_KEY, rotation becomes an auth outage. Confirm the rotation story before you need it.Ramp-up. Low for a Laravel-fluent engineer (roughly a day to read the package, two to three days for the spike). The non-obvious cost is security review time — get a second pair of eyes on the recovery-code logic and the enforcement seam before production, because that is where the package is least likely to have been battle-tested.
Recommendation. Do not adopt as a production dependency at its current maturity (0 stars, 0 dependents, unverified release metadata). Do run the time-boxed spike: the recovery-code primitives may be worth vendoring under MIT with your own tests and an internal interface, while enforcement policy and TOTP verification lean on a maintained library or Fortify. Decision gate: if the spike shows hand-rolled TOTP, plaintext secrets, or non-atomic redemption — stop and take the Fortify path.
How can I help you explore Laravel packages today?