mggflow / auth-base
v2.0.1
2023-03-08 15:28 UTC
Requires
- ext-json: *
README
安装
composer require mggflow/auth-base
关于
此包提供以下用例
- 注册用户
- 验证用户注册
- 移除未经验证的用户
- 通过以下方式验证用户:
- 登录 + 密码
- 访问令牌
- Cookie
- 通过Cookie记住用户
用法
要使用必要的情况
- 从MGGFLOW\AuthBase\Interfaces实现相应的接口
- 使用实现实例构造案例实例
- 使用公共方法
示例
$code = "received verification code"
// VerificationDataProvider implements MGGFLOW\AuthBase\Interfaces\VerifyRegData
$dataProvider = new VerificationDataProvider();
$verificationCase = new MGGFLOW\AuthBase\VerifyRegistation($dataProvider);
try {
$verificationCase->setVerificationCode($code);
$verificationCase->verify();
} catсh (NoVerificationCode | VerificationFailed $e) {
throw $e;
}