lactobasilus/email-verification
Composer 安装命令:
composer require lactobasilus/email-verification
包简介
forked form beyondcode.
README 文档
README
Installation
You can install the package via composer:
composer require beyondcode/laravel-confirm-email
Usage
This package adds a confirmed_at and confirmation_code field to your users table.
Publish the migration and the configuration file using
php artisan vendor:publish --provider="BeyondCode\EmailConfirmation\EmailConfirmationServiceProvider"
And run the migrations:
php artisan migrate
Configuring the login, register and forgot password controllers
In order to make use of the email verification, replace the AuthenticatesUsers, RegistersUsers and the SendsPasswordResetEmails traits that
come with Laravel, with the ones provided by this package.
These traits can be found in these three files:
App\Http\Controllers\Auth\LoginControllerApp\Http\Controllers\Auth\RegisterControllerApp\Http\Controllers\Auth\ForgotPasswordController
Add the confirmation and resend routes
Add the following two routes to your routes/web.php file:
Route::name('auth.resend_confirmation')->get('/register/confirm/resend', 'Auth\RegisterController@resendConfirmation'); Route::name('auth.confirm')->get('/register/confirm/{confirmation_code}', 'Auth\RegisterController@confirm');
Show confirmation messages
This packages adds some flash messages that contain error/information messages for your users.
To show them to your users, add this to your login.blade.php:
@if (session('confirmation')) <div class="alert alert-info" role="alert"> {!! session('confirmation') !!} </div> @endif
and this to both your login.blade.php and email.blade.php
@if ($errors->has('confirmation') > 0 ) <div class="alert alert-danger" role="alert"> {!! $errors->first('confirmation') !!} </div> @endif
Customization
This package comes with a language file, that allows you to modify the error / confirmation messages that your user
might see. In addition to that, you can change the notification class that will be used to send the confirmation code
completely, by changing it in the config/confirmation.php file.
Change redirect routes
You can change all possible redirect routes by including these values either as properties in your registration controller, or as methods returning the route/URL string:
redirectConfirmationToredirectAfterRegistrationToredirectAfterResendConfirmationTo
They all default to route('login').
The Confirmed Event
On successful email confirmation, this package dispatches a Confirmed event, in order for you to conveniently handle
any custom logic, such as sending a welcome email or automatically logging the user in.
Simply add the Confirmed event, and your listeners, to the EventServiceProvider in your application:
/** * The event listener mappings for the application. * * @var array */ protected $listen = [ 'BeyondCode\EmailConfirmation\Events\Confirmed' => [ 'App\Listeners\YourOnConfirmedListener' ] ];
For more information about registering events and listeners, please refer to the Laravel docs.
Testing
composer test
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security
If you discover any security related issues, please email marcel@beyondco.de instead of using the issue tracker.
Credits
License
The MIT License (MIT). Please see License File for more information.
lactobasilus/email-verification 适用场景与选型建议
lactobasilus/email-verification 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 6 次下载、GitHub Stars 达 0, 最近一次更新时间为 2021 年 04 月 07 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「beyondcode」 「laravel-confirm-email」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 lactobasilus/email-verification 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 lactobasilus/email-verification 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 lactobasilus/email-verification 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Add email verification to your Laravel projects.
Add Server-Timing header information from within your Laravel apps.
Perform various self diagnosis tests on your Laravel application.
Marcel Pociot's based beyondcode/laravel-visual-diff adapted for Laravel 7
A PHP SDK for building Claude Code hooks.
Add comments to your Laravel application
统计信息
- 总下载量: 6
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2021-04-07