{"id":15525155,"url":"https://github.com/antonioribeiro/recovery","last_synced_at":"2025-04-05T21:10:40.647Z","repository":{"id":47744794,"uuid":"103568219","full_name":"antonioribeiro/recovery","owner":"antonioribeiro","description":"Create recovery/backup codes for 2FA","archived":false,"fork":false,"pushed_at":"2024-01-18T20:13:56.000Z","size":23,"stargazers_count":85,"open_issues_count":1,"forks_count":11,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-29T20:08:07.731Z","etag":null,"topics":["2fa","laravel","php","recovery","recovery-codes","two-factor-authentication"],"latest_commit_sha":null,"homepage":null,"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/antonioribeiro.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","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":"2017-09-14T18:36:16.000Z","updated_at":"2025-02-11T21:33:34.000Z","dependencies_parsed_at":"2024-06-18T12:33:35.058Z","dependency_job_id":"ec9adf81-dbc8-49c9-bc45-a4bc56730ada","html_url":"https://github.com/antonioribeiro/recovery","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/antonioribeiro%2Frecovery","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/antonioribeiro%2Frecovery/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/antonioribeiro%2Frecovery/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/antonioribeiro%2Frecovery/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/antonioribeiro","download_url":"https://codeload.github.com/antonioribeiro/recovery/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247399885,"owners_count":20932880,"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","laravel","php","recovery","recovery-codes","two-factor-authentication"],"created_at":"2024-10-02T10:55:10.850Z","updated_at":"2025-04-05T21:10:40.610Z","avatar_url":"https://github.com/antonioribeiro.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Recovery Codes\n\n[![Latest Stable Version](https://img.shields.io/packagist/v/pragmarx/recovery.svg?style=flat-square\u0026update=123)](https://packagist.org/packages/pragmarx/recovery)\n[![Software License][ico-license]](LICENSE.md)\n[![Build Status](https://img.shields.io/scrutinizer/build/g/antonioribeiro/recovery.svg?style=flat-square)](https://scrutinizer-ci.com/g/antonioribeiro/recovery/build-status/master)\n[![Code Coverage](https://img.shields.io/scrutinizer/coverage/g/antonioribeiro/recovery.svg?style=flat-square)](https://scrutinizer-ci.com/g/antonioribeiro/recovery/?branch=master)\n[![Scrutinizer Code Quality](https://img.shields.io/scrutinizer/g/antonioribeiro/recovery.svg?style=flat-square)](https://scrutinizer-ci.com/g/antonioribeiro/recovery/?branch=master)\n[![StyleCI](https://styleci.io/repos/103568219/shield)](https://styleci.io/repos/103568219)\n\nGenerate recovery/backup codes to provide a way for your users to recover from a lost two factor auth, or any problem with it.\n\n## Install\n\nVia Composer\n\n``` bash\n$ composer require pragmarx/recovery\n```\n\n## Usage\n\n#### Basic array usage\n\n``` php\n$this-\u003erecovery = new PragmaRX\\Recovery();\n\n$this-\u003erecovery-\u003etoArray();\n```\n\n#### Collection\n\nIf you are using Laravel or install a package like [Collect](https://github.com/tightenco/collect), you can:\n\n``` php\n$this-\u003erecovery-\u003etoCollection();\n```\n\nYou can also define a different collection function to be used:\n\n``` php\n$this-\u003erecovery-\u003ecollectionFunction('alternateCollection');\n\n$this-\u003erecovery-\u003esetCount(8)-\u003etoCollection();\n```\n\n#### Json result\n\n``` php\n$this-\u003erecovery-\u003etoJson();\n```\n\nShould give you \n\n``` json\n[  \n   \"C0r2Xp4o1v-oG3pteKXw3\",\n   \"oLuSmVeJ7D-t4wnJVwkuC\",\n   \"XdPXXJy3J6-Gl3d0EwWt7\",\n   \"Bn8twjUJRt-Lv3KaAFwjR\",\n   \"SrnMagyGRg-eC7WPyFQ17\",\n   \"mRO4WPJpRN-hgfrUZqqZd\",\n   \"xBZtyFOrJZ-Tbpg0pSvzf\",\n   \"eiPFmwvJp0-oSqdNKclDH\"\n]\n```\n\n#### Changing the result values/sizes\n\n``` php\n$this-\u003erecovery\n     -\u003esetCount(8)     // Generate 8 codes\n     -\u003esetBlocks(5)    // Every code must have 7 blocks\n     -\u003esetChars(16)    // Each block must have 16 chars\n     -\u003etoArray();\n```\n\nShould give you\n\n``` json\n[  \n   \"0ldZb4vhamHEd8B3-Tmri54Lb0t52wefR-gbJaHTN44O9C1igf-HRdF185SXxDwcdRf\",\n   \"sFyrtezhjbFhCube-MszCKzvdsNL7QEY1-IY5OtpsFqM5d7jA7-t2mjCViRMHcMDdNZ\",\n   \"bjKMlcsPhNrpFpSN-IbJR2ebOeXCxXVVb-omZLu3Ki9ImIEqZh-1sK74zOADl86GGRs\",\n   \"wpa23eFj8PJcPdMG-E8A4LCwmd8iF8jt4-bVi2ltUEv29zoPJJ-pSetq2GD6euvZ9RA\",\n   \"EJ3SRDQlddr2e2hT-eF79n1lqndwhRM7G-HrjHEVyA9zHSLi8g-TrHzl5oaqPi1NgCT\",\n   \"lL7p4zjFxhQLND24-MEV1lmmyEKObjhhT-ldRWbOEnJLjBHmuc-Iex10bYAZ3NBljo2\",\n   \"uomVxkrjGYqOqmdm-AtI9MiqFEJjTlSRi-AUNEwwUfrJVP5iaH-uyrsFCrqzC3WcaAa\"\n]\n```\n\n#### Numeric or alpha?\n\n``` php\n$this-\u003erecovery\n     -\u003enumeric()       // Generate numeric only codes\n     -\u003etoArray();\n     \n$this-\u003erecovery\n     -\u003ealpha()        // Get back to default alpha generation\n     -\u003etoArray();\n```\n\n#### Upper, lower and mixed case\n\n``` php\n$this-\u003erecovery\n     -\u003elowercase()    // All lower\n     -\u003etoArray();\n     \n$this-\u003erecovery\n     -\u003euppercase()    // All upper\n     -\u003etoArray();\n     \n$this-\u003erecovery\n     -\u003emixedcase()    // Get back to default mixed case\n     -\u003etoArray();\n```\n\n#### Block separator\n\nUsually `-` is used as a block separator, but you can change it with:\n\n``` php\n$this-\u003erecovery-\u003esetBlockSeparator('|')-\u003etoJson();\n```\n\n## Change log\n\nPlease see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.\n\n## Testing\n\n``` bash\n$ composer update\n$ vendor/bin/phpunit\n```\n\n## Contributing\n\nPlease see [CONTRIBUTING](CONTRIBUTING.md) for details.\n\n## Security\n\nIf you discover any security related issues, please email acr@antoniocarlosribeiro.com instead of using the issue tracker.\n\n## Credits\n\n- [Antonio Carlos Ribeiro][link-author]\n\n## License\n\nThe MIT License (MIT). Please see [License File](LICENSE.md) for more information.\n\n[ico-version]: https://img.shields.io/packagist/v/pragmarx/recovery.svg?style=flat-square\n[ico-license]: https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square\n[ico-travis]: https://img.shields.io/travis/pragmarx/recovery/master.svg?style=flat-square\n[ico-scrutinizer]: https://img.shields.io/scrutinizer/coverage/g/pragmarx/recovery.svg?style=flat-square\n[ico-code-quality]: https://img.shields.io/scrutinizer/g/pragmarx/recovery.svg?style=flat-square\n[ico-downloads]: https://img.shields.io/packagist/dt/pragmarx/recovery.svg?style=flat-square\n\n[link-packagist]: https://packagist.org/packages/pragmarx/recovery\n[link-travis]: https://travis-ci.org/pragmarx/recovery\n[link-scrutinizer]: https://scrutinizer-ci.com/g/pragmarx/recovery/code-structure\n[link-code-quality]: https://scrutinizer-ci.com/g/pragmarx/recovery\n[link-downloads]: https://packagist.org/packages/pragmarx/recovery\n[link-author]: https://github.com/antonioribeiro\n[link-contributors]: ../../contributors\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fantonioribeiro%2Frecovery","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fantonioribeiro%2Frecovery","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fantonioribeiro%2Frecovery/lists"}