SDKs

SDK PHP

The official SDK for PHP. Requires PHP 7.4+ and the cURL extension.


Installation

bash
composer require reliant/reliant-php

Initialization

php
<?php require_once 'vendor/autoload.php'; use Reliant\Reliant; $client = new Reliant([ 'api_key' => 'rel_...', 'base_url' => 'https://reliant-production.up.railway.app', ]);

Available methods

$client->execute()

php
$result = $client->execute([ 'prompt' => 'Extract data: John Smith, john@email.com', 'schema_id' => 'sch_...', 'provider' => 'anthropic', 'model' => 'claude-sonnet-4-20250514', 'user_id' => 'your-user-id', 'options' => ['max_retries' => 3], ]); echo $result['success']; // true or false echo $result['output']['name']; // extracted field echo $result['metadata']['attempts']; echo $result['metadata']['latency_ms'];

$client->createSchema()

php
$schema = $client->createSchema([ 'name' => 'Contact Extraction', 'slug' => 'contact-extraction', 'description' => 'Extracts contact data from free text', 'definition' => [ 'type' => 'object', 'required' => ['name', 'email'], 'properties' => [ 'name' => ['type' => 'string'], 'email' => ['type' => 'string'], ], ], 'safe_fallback' => ['name' => null, 'email' => null], ]); echo $schema['id']; // created schema ID echo $schema['version']; // current version

$client->listSchemas()

php
$schemas = $client->listSchemas(); foreach ($schemas['schemas'] as $schema) { echo $schema['id'] . ' — ' . $schema['name']; }

Error handling

php
use Reliant\ReliantException; try { $result = $client->execute([...]); } catch (ReliantException $e) { echo 'Error ' . $e->getStatusCode() . ': ' . $e->getMessage(); }