PHP code example of zazama / doubleoptin

1. Go to this page and download the library: Download zazama/doubleoptin 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/ */

    

zazama / doubleoptin example snippets


    use Zazama\DoubleOptIn\Models\EmailVerification;

    public function handleFormVerification($data, $subject) {
        $email = $data['email'];
        $emailVerification = EmailVerification::create();
        $emailVerification->init($email);
        $emailVerification->send($subject);
        $emailVerification->write();
    }
    
    public function tokenChecks() {
        EmailVerification::IsSuccess($token); //bool
        EmailVerification::IsAlreadyVerified($token); //bool
        EmailVerification::IsBadToken($token); //bool
        EmailVerification::TokenType($token); //string
    }

class x extends Zazama\DoubleOptIn\Controllers\VerificationController {
  # called when successfully verified
  public function updateSuccess($token) {}

  # called when verification token is wrong / not provided
  public function updateBadToken() {}

  # called when verification token is already verified
  public function updateAlreadyVerified() {}
}

class y extends Zazama\DoubleOptIn\Models\EmailVerification {
  # change generated token
  public function updateGenerateToken($token) {}

  # change link
  public function updateLink($link) {}

  # change subject
  public function updateSubject($subject) {}
}