1. Go to this page and download the library: Download craftpulse/craft-auth-kit library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
craftpulse / craft-auth-kit example snippets
use craftpulse\authkit\AuthKit;
$tokens = AuthKit::$plugin->tokens;
// Magic links — a 32-byte secret emailed as a verify URL, no attempt cap.
$tokens->issueMagicLink($email, $returnUrl); // bool — respond identically regardless
$user = $tokens->consumeMagicLink($rawToken); // ?User
// Email OTP — short numeric code, attempt-capped, superseded on re-issue.
$tokens->issueOtp($email); // bool
$user = $tokens->consumeOtp($email, $code); // ?User
// Maintenance — prune expired rows (safe on a schedule).
$tokens->purgeExpiredTokens(); // int rows deleted
use craftpulse\authkit\services\Passwords;
use craftpulse\authkit\events\RegisterPasswordValidatorsEvent;
use yii\base\Event;
Event::on(
Passwords::class,
Passwords::EVENT_REGISTER_PASSWORD_VALIDATORS,
function(RegisterPasswordValidatorsEvent $event) {
$event->validators[] = new MyPolicyValidator();
}
);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.