mggflow / auth-base
v2.0.1
2023-03-08 15:28 UTC
Requires
- ext-json: *
README
Installation
composer require mggflow/auth-base
About
This package provides following Use Cases:
- Register User
- Verify User registration
- Remove unverified Users
- Authenticate User by:
- Login + Password
- Access Token
- Cookie
- Remember User by Cookie
Usage
To use necessary cases:
- Implement appropriate interface from MGGFLOW\AuthBase\Interfaces
- Construct an instance of case with instance of implementation
- Use public methods
Example
$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;
}