{"id":13609587,"url":"https://github.com/PHPGangsta/GoogleAuthenticator","last_synced_at":"2025-04-12T20:32:05.938Z","repository":{"id":2697055,"uuid":"3690423","full_name":"PHPGangsta/GoogleAuthenticator","owner":"PHPGangsta","description":"PHP class to generate and verify Google Authenticator 2-factor authentication","archived":false,"fork":false,"pushed_at":"2024-04-30T12:57:04.000Z","size":39,"stargazers_count":2280,"open_issues_count":58,"forks_count":707,"subscribers_count":129,"default_branch":"master","last_synced_at":"2025-04-09T19:40:42.245Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://phpgangsta.de/4376","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/PHPGangsta.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2012-03-11T23:12:04.000Z","updated_at":"2025-04-08T13:49:55.000Z","dependencies_parsed_at":"2024-01-12T10:26:04.507Z","dependency_job_id":"4355acea-4cb1-4fa8-ac47-cd8a37dbf76b","html_url":"https://github.com/PHPGangsta/GoogleAuthenticator","commit_stats":{"total_commits":43,"total_committers":15,"mean_commits":"2.8666666666666667","dds":0.6976744186046512,"last_synced_commit":"505c2af8337b559b33557f37cda38e5f843f3768"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PHPGangsta%2FGoogleAuthenticator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PHPGangsta%2FGoogleAuthenticator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PHPGangsta%2FGoogleAuthenticator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PHPGangsta%2FGoogleAuthenticator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PHPGangsta","download_url":"https://codeload.github.com/PHPGangsta/GoogleAuthenticator/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248629819,"owners_count":21136322,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-01T19:01:36.258Z","updated_at":"2025-04-12T20:32:05.607Z","avatar_url":"https://github.com/PHPGangsta.png","language":"PHP","funding_links":[],"categories":["PHP","身份验证( Authentication and Authorization )"],"sub_categories":[],"readme":"Google Authenticator PHP class\n==============================\n\n* Copyright (c) 2012-2016, [http://www.phpgangsta.de](http://www.phpgangsta.de)\n* Author: Michael Kliewe, [@PHPGangsta](http://twitter.com/PHPGangsta) and [contributors](https://github.com/PHPGangsta/GoogleAuthenticator/graphs/contributors)\n* Licensed under the BSD License.\n\n[![Build Status](https://travis-ci.org/PHPGangsta/GoogleAuthenticator.png?branch=master)](https://travis-ci.org/PHPGangsta/GoogleAuthenticator)\n\nThis PHP class can be used to interact with the Google Authenticator mobile app for 2-factor-authentication. This class\ncan generate secrets, generate codes, validate codes and present a QR-Code for scanning the secret. It implements TOTP \naccording to [RFC6238](https://tools.ietf.org/html/rfc6238)\n\nFor a secure installation you have to make sure that used codes cannot be reused (replay-attack). You also need to\nlimit the number of verifications, to fight against brute-force attacks. For example you could limit the amount of\nverifications to 10 tries within 10 minutes for one IP address (or IPv6 block). It depends on your environment.\n\nUsage:\n------\n\nSee following example:\n\n```php\n\u003c?php\nrequire_once 'PHPGangsta/GoogleAuthenticator.php';\n\n$ga = new PHPGangsta_GoogleAuthenticator();\n$secret = $ga-\u003ecreateSecret();\necho \"Secret is: \".$secret.\"\\n\\n\";\n\n$qrCodeUrl = $ga-\u003egetQRCodeGoogleUrl('Blog', $secret);\necho \"Google Charts URL for the QR-Code: \".$qrCodeUrl.\"\\n\\n\";\n\n$oneCode = $ga-\u003egetCode($secret);\necho \"Checking Code '$oneCode' and Secret '$secret':\\n\";\n\n$checkResult = $ga-\u003everifyCode($secret, $oneCode, 2);    // 2 = 2*30sec clock tolerance\nif ($checkResult) {\n    echo 'OK';\n} else {\n    echo 'FAILED';\n}\n```\nRunning the script provides the following output:\n```\nSecret is: OQB6ZZGYHCPSX4AK\n\nGoogle Charts URL for the QR-Code: https://www.google.com/chart?chs=200x200\u0026chld=M|0\u0026cht=qr\u0026chl=otpauth://totp/infoATphpgangsta.de%3Fsecret%3DOQB6ZZGYHCPSX4AK\n\nChecking Code '848634' and Secret 'OQB6ZZGYHCPSX4AK':\nOK\n```\n\nInstallation:\n-------------\n\n- Use [Composer](https://getcomposer.org/doc/01-basic-usage.md) to\n  install the package\n\n- From project root directory execute following\n\n```composer install```\n\n- [Composer](https://getcomposer.org/doc/01-basic-usage.md) will take care of autoloading\n  the library. Just include the following at the top of your file\n\n  `require_once __DIR__ . '/../vendor/autoload.php';`\n\nRun Tests:\n----------\n\n- All tests are inside `tests` folder.\n- Execute `composer install` and then run the tests from project root\n  directory\n- Run as `phpunit tests` from the project root directory\n\n\nToDo:\n-----\n- ??? What do you need?\n\nNotes:\n------\n\nIf you like this script or have some features to add: contact me, visit my blog, fork this project, send pull requests, you know how it works.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FPHPGangsta%2FGoogleAuthenticator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FPHPGangsta%2FGoogleAuthenticator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FPHPGangsta%2FGoogleAuthenticator/lists"}