Skip to main content

Installation

composer require txcloud/txcloud-php

Quick Start

<?php
require_once 'vendor/autoload.php';

use TXCloud\TXCloud;

$txcloud = new TXCloud(getenv('TXCLOUD_API_KEY'));

$verification = $txcloud->identity->verify([
    'document_front' => $documentBase64,
    'country' => 'MA',
    'document_type' => 'national_id'
]);

echo "Status: " . $verification->status;

Configuration

$txcloud = new TXCloud(
    apiKey: getenv('TXCLOUD_API_KEY'),
    environment: 'production',
    timeout: 30
);

Error Handling

use TXCloud\Exceptions\ValidationException;
use TXCloud\Exceptions\RateLimitException;

try {
    $result = $txcloud->identity->verify([...]);
} catch (ValidationException $e) {
    echo "Validation failed: " . $e->getMessage();
} catch (RateLimitException $e) {
    echo "Rate limited, retry after: " . $e->getRetryAfter();
}