{"id":19423215,"url":"https://github.com/atomjoy/google-authenticator","last_synced_at":"2026-04-18T11:33:01.757Z","repository":{"id":229268781,"uuid":"762005609","full_name":"atomjoy/google-authenticator","owner":"atomjoy","description":"2FA two-step verification with php and Google Authenticator in Laravel.","archived":false,"fork":false,"pushed_at":"2024-02-22T22:35:42.000Z","size":5,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-01T11:35:18.890Z","etag":null,"topics":["google-authenticator","google-authenticator-php"],"latest_commit_sha":null,"homepage":"https://github.com/atomjoy/google-authenticator","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/atomjoy.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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}},"created_at":"2024-02-22T22:34:14.000Z","updated_at":"2024-02-22T22:36:51.000Z","dependencies_parsed_at":"2024-03-23T06:23:59.271Z","dependency_job_id":"81e93dd9-1c3a-47d8-b96e-a14d91445d03","html_url":"https://github.com/atomjoy/google-authenticator","commit_stats":null,"previous_names":["atomjoy/google-authenticator"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/atomjoy/google-authenticator","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/atomjoy%2Fgoogle-authenticator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/atomjoy%2Fgoogle-authenticator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/atomjoy%2Fgoogle-authenticator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/atomjoy%2Fgoogle-authenticator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/atomjoy","download_url":"https://codeload.github.com/atomjoy/google-authenticator/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/atomjoy%2Fgoogle-authenticator/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31967004,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-18T00:39:45.007Z","status":"online","status_checked_at":"2026-04-18T02:00:07.018Z","response_time":103,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["google-authenticator","google-authenticator-php"],"created_at":"2024-11-10T13:37:27.758Z","updated_at":"2026-04-18T11:33:01.719Z","avatar_url":"https://github.com/atomjoy.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PHP Google Authenticator\n\n2FA two-step verification with php and Google Authenticator in Laravel.\n\n## Install\n\n```sh\ncomposer require atomjoy/google-authenticator\n```\n\n## GoogleAuthenticator in Laravel\n\nHow to generate code from user secret like in GoogleAuthenticator on Android but from php script.\n\n```php\n\u003c?php\n\nuse Atomjoy\\GoogleAuthenticator\\GoogleAuthenticator;\nuse Illuminate\\Support\\Facades\\Route;\n\n// Get GoogleAuthenticator code\nRoute::get('/test/2fa/google/{secret}', function ($secret) {\n  // Authenticator\n  $ga = new GoogleAuthenticator();\n\n  // Create secret for user (first time)\n  if ($secret == 'create') {\n    // Create secret enable 2fa (save secret in database)\n    $secret = $ga-\u003ecreateSecret();\n\n    // QR-Code image\n    $url = $ga-\u003egetQRCodeUrl('Appname:user@example.com', $secret);\n\n    // Show user qr-code\n    echo \"\u003ch1\u003eNew secret is: \" . $secret . \"\u003c/h1\u003e\";\n    echo '\u003ch2\u003eGoogle Charts URL for the QR-Code:\u003c/h2\u003e';\n    echo '\u003cp\u003e\u003cimg src=\"' . $url . '\"\u003e \u003c/p\u003e';\n  } else {\n    // Generate code from user secret like in GoogleAuthenticator on Android but from php script\n    // Past this code in github 2fa confirm code form\n    $code = $ga-\u003egetCode($secret);\n    echo \"\u003cp\u003eChecking code \u003cb\u003e\" . $code . \"\u003c/b\u003e and Secret \u003cb\u003e\" . $secret . \"\u003c/b\u003e use this code in 2fa on github, facebook, ...\u003c/p\u003e\";\n\n    // Confirm code (allow 2*30sec clock tolerance)\n    if ($ga-\u003everifyCode($secret, $code, 2)) {\n      echo '\u003ch3 style=\"color: #5c5\"\u003eOK\u003c/h3\u003e';\n    } else {\n      echo '\u003ch3 style=\"color: #f23\"\u003eFAILED\u003c/h3\u003e';\n    }\n  }\n});\n```\n\n## Enable github two factor with php script\n\n```sh\nphp artisan serve\n\n# 1. Get and save generated secret when enabling two-factor authentication in panel settings\n# QR-code example github_2fa_secret: FA7DKAS2MK6SH3BN\n\n# 2. Enable or Login with 2fa secret\n# Get 6-digit code and past in github 2fa form 😄 (refresh every 30 seconds)\nhttp://127.0.0.1:8000/test/2fa/google/{github_2fa_secret}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fatomjoy%2Fgoogle-authenticator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fatomjoy%2Fgoogle-authenticator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fatomjoy%2Fgoogle-authenticator/lists"}