Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.spairehq.com/llms.txt

Use this file to discover all available pages before exploring further.

Installation

Terminal
composer require spaire-tech/spaire-php

Quickstart

index.php
<?php

declare(strict_types=1);

require 'vendor/autoload.php';

use Spaire\Spaire;

$sdk = Spaire::builder()
    ->setSecurity(getenv('SPAIRE_ACCESS_TOKEN'))
    ->build();

$responses = $sdk->organizations->list(
    page: 1,
    limit: 10
);

foreach ($responses as $response) {
    if ($response->statusCode === 200) {
        // handle response
    }
}

Sandbox Environment

You can configure the SDK to hit the sandbox environment instead of production by setting the server when building the client:
$sdk = Spaire::builder()
    ->setServer('sandbox')
    ->setSecurity(getenv('SPAIRE_ACCESS_TOKEN'))
    ->build();