定制 selim-salihovic/verifi 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

selim-salihovic/verifi

Composer 安装命令:

composer require selim-salihovic/verifi

包简介

A Laravel package to handle email verification.

README 文档

README

Travis Packagist Packagist Packagist

A Laravel package to handle email verification.

It is inspired by crypto-based password resets and the email verification package by josiasmontag.

  • Crypto-based email verification. No need to store a temporary token in the database!
  • Event-based totally. No need to override your register() method.
  • Using the Laravel 5.4 notification system.
  • You're free to create routes anyway you like.
  • Resend the verification email anytime.
  • Customize the email notification.

Installation

Install this package via Composer.

composer require meness/verifi

You must install both the service provider and the facade.

'providers' => [
    ...
    Meness\Verifi\Providers\VerifiServiceProvider::class,
];

'aliases' => [
    ...
    'Verifi' => Meness\Verifi\Facades\Verifi::class,
];

A migration is provided to add a is_email_verified column to the existing users table, you can publish the migration.

php artisan vendor:publish --provider="Meness\Verifi\Providers\VerifiServiceProvider" --tag="migrations"

Remember to run the following command if you published the migration.

php artisan migrate

A configuration file is also provided, you can publish the configuration.

php artisan vendor:publish --provider="Meness\Verifi\Providers\VerifiServiceProvider" --tag="config"

Configuration

expiration

1440 (in minutes, 24 hours) set by default.

verify_route

/verify set by default. Change the value if you're using a different route for verification.

send_notifications

true set by default. Let this package send an email notification automatically after the registration complete.

How to Use (Step by Step)

Step One

  1. The User model must implement Meness\Verifi\Entities\Traits\Contracts\Verifi interface.

  2. Add Meness\Verifi\Entities\Traits\VerifiTrait as a trait if you're going to use the default notification.

class User extends Authenticatable implements Verifi
{
    use Notifiable, VerifiTrait;
}

Note: Some methods are not implemented, you must do it yourself.

Step Two

You're free to create routes, because there're no default routes provided with this package.

Route::get('/verify', 'Auth\RegisterController@verify');
Route::get('/resend', 'Auth\RegisterController@resend');

Note: Remember to change the verify_route value if you're not going to use the default route.

Step Three (Optional)

Create listeners for necessary events. There're three events provided with this package: InvalidCredentials, VerificationSent, and Verified.

Step Four

There're two methods available, verify() and resend().

Note: An email verification will be sent after the registration complete if send_notifications set true, so you're not required to do it manually.

verify()

Verifi::verify() expects a request object and an optional callback. It verifies credentials provided with the request.

Verifi::verify(request(), function ($user) {

	if (is_null($user)) {
		// Invalid credentials provided
	} else {
		// Verified
	}
});

resend()

Verifi::resend() expects an user model object and an optional callback. It sends the verification email to the provided user.

Verifi::resend($user, function ($user) {
	// Resent successfully
});

Step Five (Optional)

There's a middleware called IsEmailVerified to determine if the user's email address is verified.

$routeMiddleware = [
    ...
    'isEmailVerified' => \Meness\Verifi\Http\Middleware\IsEmailVerified::class,
];

Changelog

Please see releases for more information what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Credits

License

Verifi is open-sourced software licensed under the MIT license.

selim-salihovic/verifi 适用场景与选型建议

selim-salihovic/verifi 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 10 次下载、GitHub Stars 达 1, 最近一次更新时间为 2017 年 08 月 28 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「email」 「laravel」 「verification」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 selim-salihovic/verifi 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 selim-salihovic/verifi 我们能提供哪些服务?
定制开发 / 二次开发

基于 selim-salihovic/verifi 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 10
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 6
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-08-28