PHP code example of colu / colu

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

    

colu / colu example snippets



use Colu\ColuSDK\Colu;
$colu = new Colu('my_company', 'testnet');

// This is your private key, keep it safe!!!
echo 'WIF: '.$colu->getWIF();


use Colu\ColuSDK\Colu;

$privateKey = 'cQQy71GeXGeFWnDtypas2roY2qrk3KWjJLCxoFqc2wibXr2wWxie'; // this is the WIF version of a private key

$colu = new Colu('my_company', 'testnet', $privateKey);

  $username = 'bob';
  $registrationMessage = $colu->createRegistrationMessage($username);
  

  $qr = $colu->createRegistrationQR($registrationMessage);
  

	"qr" => $qrCode->getDataUri (), // this is the actual QR image
	"code" => $qrRegCode, // send this to the registerUserByCode function
	"message" => $message // send this to the registerUserByCode function 
  

  $colu->registerUserByCode ( $code, $message );
  

  $phonenumber = "+12323455673";
  $colu->registerUserByPhonenumber ( $phonenumber, $registrationMessage );
  

"success" => true,
"userId" => $user->getId () // this is the user ID

$username = 'bob';
$userId = 'tpubDCgCu2jpxrR7j9JwFQ959wSkNwPQFNQvJJMFnikg1Sb4tkDnBNYaS3Sc1BxKL71hk3jPkQStEY1VE9mTaQjF8kDfEhzxjWid7eVK5F7nWi5';

if ($colu->verifyUser($username, $userId, 0)) {
    echo "verified";
  }
  else {
    echo $colu->error;
    // something bad happened
  }
}