{"id":19760040,"url":"https://github.com/wotzebra/laravel-verification-code","last_synced_at":"2025-05-16T18:06:11.615Z","repository":{"id":40246489,"uuid":"237925389","full_name":"wotzebra/laravel-verification-code","owner":"wotzebra","description":"Authenticate users using a verification code sent to their mail.","archived":false,"fork":false,"pushed_at":"2025-03-05T10:12:07.000Z","size":146,"stargazers_count":63,"open_issues_count":2,"forks_count":21,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-05-16T18:05:21.276Z","etag":null,"topics":["authentication","laravel","php","verification"],"latest_commit_sha":null,"homepage":"","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/wotzebra.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,"zenodo":null}},"created_at":"2020-02-03T09:11:03.000Z","updated_at":"2025-03-17T03:02:55.000Z","dependencies_parsed_at":"2023-12-13T12:27:45.129Z","dependency_job_id":"7a0881fc-c054-48c8-9950-89346e9e4422","html_url":"https://github.com/wotzebra/laravel-verification-code","commit_stats":{"total_commits":103,"total_committers":11,"mean_commits":9.363636363636363,"dds":0.6893203883495146,"last_synced_commit":"7522a7a55a2d0f085395ef08c13947455dac52fd"},"previous_names":["wotzebra/laravel-verification-code","nextapps-be/laravel-verification-code"],"tags_count":19,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wotzebra%2Flaravel-verification-code","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wotzebra%2Flaravel-verification-code/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wotzebra%2Flaravel-verification-code/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wotzebra%2Flaravel-verification-code/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wotzebra","download_url":"https://codeload.github.com/wotzebra/laravel-verification-code/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254582904,"owners_count":22095518,"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":["authentication","laravel","php","verification"],"created_at":"2024-11-12T03:34:56.188Z","updated_at":"2025-05-16T18:06:11.581Z","avatar_url":"https://github.com/wotzebra.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Laravel Verification Code\n\n[![Latest Version on Packagist](https://img.shields.io/packagist/v/wotz/laravel-verification-code.svg?style=flat-square)](https://packagist.org/packages/wotz/laravel-verification-code)\n[![Total Downloads](https://img.shields.io/packagist/dt/wotz/laravel-verification-code.svg?style=flat-square)](https://packagist.org/packages/wotz/laravel-verification-code)\n\nThis package makes it possible to authenticate a user via a verification code.\n\n## Installation\n\nYou can install this package using composer:\n\n```bash\ncomposer require wotz/laravel-verification-code\n```\n\nThe package will automatically register itself.\n\nYou can publish the migration with:\n```bash\nphp artisan vendor:publish --provider=\"Wotz\\VerificationCode\\VerificationCodeServiceProvider\" --tag=\"migrations\"\n```\n\nAfter publishing the migration, run the migration with:\n```bash\nphp artisan migrate\n```\n\nYou can publish the config file with:\n```bash\nphp artisan vendor:publish --provider=\"Wotz\\VerificationCode\\VerificationCodeServiceProvider\" --tag=\"config\"\n```\n\n## Usage\n\n### Generate and send a verification code\n```php\nuse Wotz\\VerificationCode\\VerificationCode;\n\nVerificationCode::send($email);\n```\nThis will generate a verification code for the user. The code will be stored in the `verification_codes` table. An email with the generated code will then be sent to the user matching the given email address.\n\n### Verify a verification code\n```php\nuse Wotz\\VerificationCode\\VerificationCode;\n\nVerificationCode::verify($code, $email);\n```\nIf the verification code is expired or does not match the user's email address, it will return `false`. If valid, it will return `true` and delete the code.\n\nIf you do not want the code to be deleted (in case the same code needs to be verified at different points in the login flow) you can pass a third parameter.\n\n```php\nuse Wotz\\VerificationCode\\VerificationCode;\n\nVerificationCode::verify($code, $email, $deleteAfterVerification);\n```\n\n\n### Verification codes table cleanup\n\nSince it is possible for the verification codes table to fill up with unused codes, the following command will prune all codes older than the given hours.\n\n```php\nphp artisan verification-code:prune --hours=24\n```\n\n## Config settings\n\n### Length\nThis value defines the length of every generated verification code.\n\n### Characters\nYou can define which characters are used to generate a verification code. By default, certain characters are excluded (0, O, I, L) because they look too similar.\n\n### Expire seconds\nA verification code is only valid for a certain amount of time. You can define after how many seconds a verification code will expire.\n\n### Max codes per verifiable\n\nBy default, only one verification code can be active per verifiable. If you want to allow multiple active codes per verifiable, then you can\nchange this setting to a different number (or to `null` if you want unlimited codes per verifiable).\n\n### Custom Notification\nIf you want to use a custom notification to send the verification code, you can create your own notification class which should extend the `VerificationCodeCreatedInterface`. Make sure you don't forget to pass the verification code to the mail.\n\n### Custom Model\nIf you want to use a custom verification code model, you can create your own verification code class which should extend the `VerificationCode`.\n\n### Queue\nIf your notification is queueable, you can  define the queue that will be used for the notification.\n\n### Test verifiables and test code\nYou sometimes may want to allow a user to log in immediately without letting them go through the verification code flow. To do this you can add the verifiable (e.g. email address) to the `test_verifiables` array. You then need to define a `test_code`. The combination of the verifiable and the test code will make it possible for the user to pass through.\n\n## Testing\nYou can run tests with:\n``` bash\ncomposer test\n```\n## Linting\n\n```bash\ncomposer lint\n```\n## Changelog\n\nPlease see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.\n\n## Contributing\n\nPlease see [CONTRIBUTING](CONTRIBUTING.md) for details.\n\n## Credits\n\n- [Günther Debrauwer](https://github.com/gdebrauwer)\n- [All Contributors](../../contributors)\n\n## License\n\nThe MIT License (MIT). Please see [License File](LICENSE.md) for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwotzebra%2Flaravel-verification-code","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwotzebra%2Flaravel-verification-code","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwotzebra%2Flaravel-verification-code/lists"}