{"id":19536380,"url":"https://github.com/hoangphidev/google-2fa","last_synced_at":"2025-02-26T04:19:53.843Z","repository":{"id":110573325,"uuid":"315977632","full_name":"hoangphidev/google-2fa","owner":"hoangphidev","description":"🚀 Laravel package about Google Authenticator.","archived":false,"fork":false,"pushed_at":"2020-11-25T15:21:08.000Z","size":10,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-08T17:58:11.386Z","etag":null,"topics":["2fa","2fa-security","2factor","google-2fa","google-authenticator","laravel","laravel-2fa","laravel-framework","laravel-package"],"latest_commit_sha":null,"homepage":"https://packagist.org/packages/hoangphi/google-2fa","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hoangphidev.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","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":"2020-11-25T15:20:20.000Z","updated_at":"2020-11-25T15:52:20.000Z","dependencies_parsed_at":"2023-03-24T11:03:32.311Z","dependency_job_id":null,"html_url":"https://github.com/hoangphidev/google-2fa","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hoangphidev%2Fgoogle-2fa","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hoangphidev%2Fgoogle-2fa/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hoangphidev%2Fgoogle-2fa/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hoangphidev%2Fgoogle-2fa/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hoangphidev","download_url":"https://codeload.github.com/hoangphidev/google-2fa/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240789779,"owners_count":19857894,"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":["2fa","2fa-security","2factor","google-2fa","google-authenticator","laravel","laravel-2fa","laravel-framework","laravel-package"],"created_at":"2024-11-11T02:22:41.430Z","updated_at":"2025-02-26T04:19:53.815Z","avatar_url":"https://github.com/hoangphidev.png","language":"PHP","readme":"## Google Authenticator Laravel Package\n\n\n* Copyright (c) 2020, [Phi Hoang JSC](https://github.com/hoangphidev)\n* Author: Phi Hoang, [@hoangphidev](https://github.com/hoangphidev) and [contributors](https://github.com/hoangphidev/google-2fa/graphs/contributors)\n* Licensed under the MIT License.\n\n[![Latest Version on Packagist](https://img.shields.io/packagist/v/hoangphi/google-2fa.svg?style=flat-square)](https://packagist.org/packages/hoangphi/google-2fa)\n[![Total Downloads](https://img.shields.io/packagist/dt/hoangphi/google-2fa.svg?style=flat-square)](https://packagist.org/packages/hoangphi/google-2fa)\n\n## Install\n\n```shell\ncomposer require hoangphi/google-2fa\n```\n\n## Config\n\nAdd column `secret_code`\n\n```shell\nphp artisan google-2fa:make \u003ctable_name\u003e\n```\n\n### Example\n\nAdd column `secret_code` into table `users`\n\n```shell\nphp artisan google-2fa:make users\n```\n\nWe have file `database\\migrations\\{time_stamp}_add_secret_code_to_users.php`\n\n```php\n\u003c?php\n\nuse Illuminate\\Database\\Migrations\\Migration;\nuse Illuminate\\Database\\Schema\\Blueprint;\nuse Illuminate\\Support\\Facades\\Schema;\n\nclass AddSecretCodeToUsers extends Migration\n{\n    /**\n     * Run the migrations.\n     *\n     * @return void\n     */\n    public function up()\n    {\n        Schema::table('users', function (Blueprint $table) {\n            $table-\u003estring('secret_code')-\u003enullable()-\u003eafter('id');\n        });\n    }\n\n    /**\n     * Reverse the migrations.\n     *\n     * @return void\n     */\n    public function down()\n    {\n        Schema::table('users', function (Blueprint $table) {\n            $table-\u003edropColumn('secret_code');\n        });\n    }\n}\n\n```\n\nRun `migrate` command\n\n```shell\nphp artisan migrate\n```\n\nYou must migrate table `users` before.\n\n## Usage\n\nSee following example:\n\n```php\nuse HoangPhi\\GoogleAuthenticator\\GoogleAuthenticator;\n\n$googleAuthenticator = new GoogleAuthenticator();\n$secret = $googleAuthenticator-\u003ecreateSecret();\necho \"Secret is: \" . $secret . \"\\n\\n\";\n\n$qrCodeUrl = $googleAuthenticator-\u003egetQRCodeGoogleUrl('Blog', $secret);\necho \"Google Charts URL for the QR-Code: \".$qrCodeUrl.\"\\n\\n\";\n\n$oneCode = $googleAuthenticator-\u003egetCode($secret);\necho \"Checking Code '$oneCode' and Secret '$secret':\\n\";\n\n$checkResult = $googleAuthenticator-\u003everifyCode($secret, $oneCode, 2);    // 2 = 2*30sec clock tolerance\nif ($checkResult) {\n    echo 'OK';\n} else {\n    echo 'FAILED';\n}\n```\n\n## Changelog\n\nPlease see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.\n\n## Security\n\nIf you discover any security-related issues, please email [hoangphidev@gmail.com](mailto:hoangphidev@gmail.com) instead of using the issue tracker.\n\n## Credits\n\n- [Phi Hoang](https://github.com/hoangphidev)\n- [All Contributors](../../contributors)\n\n## References\n\n- [Google Authenticator PHP class](https://github.com/PHPGangsta/GoogleAuthenticator)\n\n## License\n\nThe Laravel framework is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhoangphidev%2Fgoogle-2fa","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhoangphidev%2Fgoogle-2fa","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhoangphidev%2Fgoogle-2fa/lists"}