PHP code example of invex / invexgate-php

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

    

invex / invexgate-php example snippets


use BarubiTech\Invexgate\Client;

$publicKey = 'ig_live_...';
$secretKey = 'ig_sandbox_...';

$client = new Client($publicKey, $secretKey);

try {
    $response = $client->verifyLicense('XXXX-XXXX-XXXX-XXXX', 'example.com');
    if ($response['valid']) {
        echo "Licence valide !";
    }
} catch (\BarubiTech\Invexgate\Exceptions\InvexgateException $e) {
    echo "Erreur : " . $e->getMessage();
}

try {
    $response = $client->activateLicense('XXXX-XXXX-XXXX-XXXX', 'example.com', [
        'metadata' => ['custom_id' => 123]
    ]);
    echo "Licence activée avec succès.";
} catch (\BarubiTech\Invexgate\Exceptions\InvexgateException $e) {
    echo "Erreur d'activation : " . $e->getMessage();
}
bash
composer