jocic/google-authenticator
Composer 安装命令:
composer require jocic/google-authenticator
包简介
Complete & easy-to-implement MFA solution for use with Google Authenticator App.
关键字:
README 文档
README
Google Authenticator is a mini PHP library for implementing Multi-Factor Authentication by utilizing Google's Authenticator App. It was written to simplify the usually complicated implementation process.
Following specifications were referenced:
- RFC 4226 - HMAC-Based One-Time Password Algorithm
- RFC 6238 - TOTP: Time-Based One-Time Password Algorithm
- RFC 6287 - OCRA: OATH Challenge-Response Algorithm
Song of the project: Iron Maiden - The Trooper
Versioning Scheme
I use a 3-digit Semantic Versioning identifier, for example 1.0.2. These digits have the following meaning:
- The first digit (1) specifies the MAJOR version number.
- The second digit (0) specifies the MINOR version number.
- The third digit (2) specifies the PATCH version number.
Complete documentation can be found by following the link above.
Examples
Following examples should be more then enough to get you started. I tried my best to make them as simple as possible so that everyone, even junior developers, can successfully use them for implementing two-factor authentication.
- Creating a Secret
- Secret Creation Methods
- Setting Existing Secrets
- Creating an Account
- Account Management
- QR Codes
- Code Validation
For additional examples please review the official project's wiki.
Requirements
You only need to have PHP >=7.0 available on your system to use Google Authenticator in your application. However, for running unit tests, you need to have the following extensions installed:
Installation
There's two ways you can add Google Authenticator library to your project:
- Copying files from the "source" directory to your project and requiring the "Autoload.php" script (this includes doing the same for project's dependencies ex. Encoders)
- Via Composer, by executing the command below
composer require jocic/google-authenticator 1.0.0
Tests
Following unit tests are available:
- Essentials - Tests for library's essentials ex. Autoloader, Base 32 encoder, etc.
- QR Generators - Tests for available QR code generators in the library.
- Elements - Tests for library's core elements ex. Secret, Account, etc.
You can execute them easily from the terminal like in the example below.
bash ./scripts/phpunit.sh --testsuite essentials bash ./scripts/phpunit.sh --testsuite qr-generators bash ./scripts/phpunit.sh --testsuite elements
Please don’t forget to install necessary dependencies before attempting to do the God's work above. They may be important.
bash ./scripts/composer.sh install
Contribution
Please review the following documents if you are planning to contribute to the project:
Integration
My hourly rate is fairly reasonable so, if you need help with integrating Google Authenticator to your existing project, feel free to contact me via the email below.
Integration inquiries: office@djordjejocic.com
Support
Please don't hesitate to contact me if you have any questions, ideas, or concerns.
My Twitter account is: @jocic_91
My support E-Mail address is: support@djordjejocic.com
Copyright & License
Copyright (C) 2018 Đorđe Jocić
Licensed under the MIT license.
jocic/google-authenticator 适用场景与选型建议
jocic/google-authenticator 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1.3k 次下载、GitHub Stars 达 25, 最近一次更新时间为 2018 年 12 月 19 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「MFA」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 jocic/google-authenticator 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 jocic/google-authenticator 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 jocic/google-authenticator 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
This extension adds the E-Mail MFA provider to TYPO3.
This package provides Laravel bindings and a Eloquent/Model trait for pragmarx/recovery package.
YubiKey OTP MFA provider - YubiKey OTP MFA provider for the TYPO3 backend login.
Boilerplate default access rules for Silverstripe websites
API-only Multi-Factor Authentication enforcement for Laravel (TOTP, middleware-driven)
Duo Security Universal Prompt two-factor authentication for Roundcube. Supports multiple authentication methods including push notifications, SMS, phone calls, and hardware tokens.
统计信息
- 总下载量: 1.3k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 25
- 点击次数: 14
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2018-12-19

