pragmarx/google2fa
A One Time Password Authentication package, compatible with Google Authenticator.
v9.1.0
109M downloads/mo
#190 most downloaded on composer
antonioribeiro/google2fa
What this package is like to depend on
Last release 8 days ago
15 Aug 2026
Release timing varies
gaps range from 9 days to 2.2 years
Some releases are documented
notes for 20 of 36 stable releases
Nothing withdrawn
no release was ever pulled
12 years old
36 releases · first in 2014
2 releases in the last 12 months
see the full history below
Release timeline
36 releases · Sep 2014 to Aug 2026Releases
latest 36-
v9.1.015 Aug 2026Release notes
Open source →PHP 8.6 (beta) support, Psalm static analysis, and CI/governance modernization.
Added
- PHP 8.6 (beta) added to the CI matrix, with automatic fallback while the
toolchain catches up - Psalm static analysis alongside PHPStan, including psalm/plugin-phpunit so
the test suite resolves cleanly - SECURITY.md, SUPPORT.md, and a Version Support policy documenting which
branches receive fixes - CONTRIBUTING.md, issue/PR templates, CODEOWNERS, and Dependabot
(composer + github-actions) - composer.json support block and expanded keywords
Changed
- Widened dev-tooling constraints: PHPUnit ~9-13, PHPStan ^1.0|^2.0
- Modernized CI: explicit PHP<->PHPUnit compatibility matrix, pcov coverage,
updated action versions, added a legacy-stack verification job - Simplified getTimestamp()'s division (credit: Michal Spacek, #232)
Fixed
- Codecov upload no longer hard-fails CI when the token is unavailable
(e.g. fork pull requests) - Removed the dead code-quality job and retired Scrutinizer (unused,
pointed at a coverage file no longer produced) - Three separate GitHub Actions were stuck on deprecated Node.js 20
(actions/cache, codecov-action's internal pin, actions/setup-node)
No behavioral changes to secret generation, HMAC computation, or OTP
verification. See docs/audit/9.x-ci-and-governance/03-src-security-review.md
for the line-by-line review.Release notes
Open source →Added
- Support for PHP 8.6 (beta) in the CI test matrix, with automatic fallback (
continue-on-error) while the toolchain catches up - Psalm static analysis alongside PHPStan, including the
psalm/plugin-phpunitplugin so PHPUnit'sTestCasehierarchy resolves correctly - SECURITY.md, SUPPORT.md, and a Version Support policy documenting which branches receive fixes
composer.jsonsupportblock (issues/source/docs/security) and expanded keywords (totp,hotp,otp,mfa,rfc4226,rfc6238)
Changed
- Widened dev-tooling constraints: PHPUnit
~9|~10|~11|~12|~13, PHPStan^1.0|^2.0 - Modernized CI: explicit PHP↔PHPUnit compatibility matrix, pcov coverage, updated action versions, added a legacy-stack verification job
- Simplified
getTimestamp()'s division (credit: Michal Špaček, cherry-picked from #232)
Fixed
- Codecov upload no longer hard-fails CI when
secrets.CODECOV_TOKENis unavailable (e.g. on fork pull requests) - Removed the dead
code-qualityjob (Prettier/Node.js) that never ran against this PHP-only package - Retired
.scrutinizer.yml, which pointed at a coverage file no longer produced; Codecov already covers this
Security
- No behavioral change to secret generation, HMAC computation, or OTP verification — see
docs/audit/9.x-ci-and-governance/03-src-security-review.mdfor the line-by-line review
- PHP 8.6 (beta) added to the CI matrix, with automatic fallback while the
-
v9.0.019 Sep 2025Release notes
Open source →⚠️ Version 9.0.0 Breaking Change
Default Secret Key Length Increased
Version 9.0.0 introduces a breaking change: The default secret key length has been increased from 16 to 32 characters for enhanced security.
What Changed?
generateSecretKey()now generates 32-character secrets by default (previously 16)- This increases cryptographic entropy from 80 bits to 160 bits
- Maintains full compatibility with Google Authenticator and other TOTP apps
Migration Guide
If you want to keep the previous behavior (16-character secrets):
// Old default behavior (v8.x and below) $secret = $google2fa->generateSecretKey(); // New way to get 16-character secrets (v9.0+) $secret = $google2fa->generateSecretKey(16); If you want to use the new default (32-character secrets): // This now generates 32-character secrets by default $secret = $google2fa->generateSecretKey(); Potential Impact Areas - Database schemas: Check if your google2fa_secret columns can handle 32 characters - Validation rules: Update any length validations that expect exactly 16 characters - Tests: Update test assertions expecting 16-character secrets - UI components: Ensure QR code displays and secret key fields accommodate longer secrets Important: Existing 16-character secrets remain fully functional. Database updates are only needed if you want to use the new 32-character default behavior. Why This Change? While 16-character secrets meet RFC 6238 minimum requirements, 32-character secrets provide significantly better security: - 16 chars: 80 bits of entropy (adequate but minimal) - 32 chars: 160 bits of entropy (much stronger against brute force) This change aligns with modern security best practices for cryptographic applications.
Release notes
Open source →⚠️ Breaking Change
Added
- Increased default secret key length from 16 to 32 characters for enhanced security
- Cryptographic entropy increased from 80 bits to 160 bits
- Maintains full compatibility with Google Authenticator and other TOTP apps
Changed
generateSecretKey()now generates 32-character secrets by default- To maintain previous behavior, use
generateSecretKey(16) - Updated tests to reflect new default behavior
Security
- This change significantly improves security against brute force attacks
- 32-character secrets provide stronger cryptographic protection while maintaining RFC 6238 compliance
-
v8.0.305 Sep 2024Nothing published for this version
-
v8.0.213 Jul 2024Nothing published for this version
-
v8.0.113 Jun 2022 -
8.0.005 Apr 2020Release notes
Open source →Merge pull request #153 from antonioribeiro/analysis-YjDN3K
Apply fixes from StyleCI
[ci skip] [skip ci]
Release notes
Open source →Added
- PHP 8 Support
- Tests
- Extract som test helpers
- PHPStan checks
Changed
- PHP required version bumped to >= 7.1
- Exception interfaces extending Throwable
-
v7.0.021 Oct 2019Release notes
Open source →Added
- PHPStan checks
Removed
- Constants::ARGUMENT_NOT_SET - This is a BC break
-
v6.1.302 Oct 2019 -
v6.1.023 Sep 2019Nothing published for this version
-
v6.0.118 Sep 2019Nothing published for this version
-
v6.0.011 Sep 2019Release notes
Open source →Added
- Base exception class and interfaces
Removed
- Support for PHP 5.4 to 7.0, will keep supporting PHP 7.1, 7.2, 7.3 & 7.4
-
v5.0.019 Mar 2019 -
v4.0.219 Mar 2019Nothing published for this version
-
v4.0.119 Mar 2019Nothing published for this version
-
v4.0.006 Oct 2018 -
v3.0.329 Aug 2018Nothing published for this version
-
v3.0.231 Jul 2018Nothing published for this version
-
v3.0.115 Mar 2018 -
v3.0.007 Mar 2018Release notes
Open source →Changed
- It's now mandatory to enable Google Api secret key access by executing
setAllowInsecureCallToGoogleApis(true);
- It's now mandatory to enable Google Api secret key access by executing
-
v2.0.706 Jan 2018Nothing published for this version
-
v2.0.612 Sep 2017Nothing published for this version
-
v2.0.503 Jul 2017Nothing published for this version
-
v2.0.422 Jun 2017 -
v2.0.322 Jun 2017Nothing published for this version
-
v2.0.221 Jun 2017Nothing published for this version
-
v2.0.121 Jun 2017 -
v2.0.020 Jun 2017Release notes
Open source →Changed
- Drop the Laravel support in favor of a bridge package (https://github.com/antonioribeiro/google2fa-laravel).
- Using a more secure Base 32 algorithm, to prevent cache-timing attacks.
- Added verifyKeyNewer() method to prevent reuse of keys.
- Refactored to remove complexity, by extracting support methods.
- Created a package playground page (https://pragmarx.com/google2fa)
-
v1.0.118 Jul 2016Release notes
Open source →Changed
- Drop support for PHP 5.3.7, require PHP 5.4+.
- Coding style is now PSR-2 automatically enforced by StyleCI.
-
v1.0.017 Jul 2016 -
v0.8.117 Jul 2016 -
v0.8.017 Jul 2016Release notes
Open source →Changed
- Bumped christian-riesen/base32 to ~1.3
- Use paragonie/random_compat to generate cryptographically secure random secret keys
- Readme improvements
- Drop simple-qrcode in favor of bacon/bacon-qr-code
- Fix tavis setup for phpspec, PHP 7, hhvm and improve cache
-
v0.7.107 Nov 2015Nothing published for this version
-
v0.7.007 Nov 2015 -
v0.6.006 Nov 2015Nothing published for this version
-
v0.5.020 Feb 2015Nothing published for this version
-
v0.1.022 Sep 2014