<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
devsrealm / csskiller-plugin-mail-contract example snippets
use CSSKillerMailContract\services\TokenSignatureService;
// Generate a confirmation token
$service = new TokenSignatureService($core);
$token = $service->generateToken('[email protected]', [
'ip_address' => $_SERVER['REMOTE_ADDR'],
'user_agent' => $_SERVER['HTTP_USER_AGENT']
]);
// Generate a full confirmation link
$confirmation = $service->generateConfirmationLink(
email: '[email protected]',
baseUrl: 'https://yoursite.com/terms/confirm',
metadata: ['source' => 'registration']
);
// Validate a token
$result = $service->validateToken($token);
if ($result['valid']) {
// Mark as confirmed
$service->markAsConfirmed($token, $_SERVER['REMOTE_ADDR']);
}
// Get all tokens for an email
$tokens = $service->getTokensByEmail('[email protected]');