PHPackages                             spaire-tech/spaire-php - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. spaire-tech/spaire-php

ActiveLibrary

spaire-tech/spaire-php
======================

v0.9.0(2d ago)00[1 PRs](https://github.com/Spaire-Tech/spaire-php/pulls)MITPHPPHP &gt;=8.2CI passing

Since Mar 22Pushed todayCompare

[ Source](https://github.com/Spaire-Tech/spaire-php)[ Packagist](https://packagist.org/packages/spaire-tech/spaire-php)[ RSS](/packages/spaire-tech-spaire-php/feed)WikiDiscussions main Synced today

READMEChangelog (1)Dependencies (11)Versions (4)Used By (0)

spaire-tech/sdk
===============

[](#spaire-techsdk)

Developer-friendly &amp; type-safe Php SDK specifically catered to leverage *spaire-tech/sdk* API.

 [![](https://camo.githubusercontent.com/096b86187dea2c62026c9750456a53a3e7c20fdd95fa1b55f5cc9a67ebc2078d/68747470733a2f2f637573746f6d2d69636f6e2d6261646765732e64656d6f6c61622e636f6d2f62616467652f2d4275696c742532304279253230537065616b656173792d3231323031353f7374796c653d666f722d7468652d6261646765266c6f676f436f6c6f723d464245333331266c6f676f3d737065616b65617379266c6162656c436f6c6f723d353435343534)](https://www.speakeasy.com/?utm_source=spaire-tech/sdk&utm_campaign=php) [ ![](https://camo.githubusercontent.com/08cef40a9105b6526ca22088bc514fbfdbc9aac1ddbf8d4e6c750e3a88a44dca/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d626c75652e737667) ](https://opensource.org/licenses/MIT)

Important

This SDK is not yet ready for production use. To complete setup please follow the steps outlined in your [workspace](https://app.speakeasy.com/org/spaire/spaire). Delete this section before &gt; publishing to a package manager.

Summary
-------

[](#summary)

Spaire API: Spaire HTTP and Webhooks API

Read the docs at

Table of Contents
-----------------

[](#table-of-contents)

- [spaire-tech/sdk](#spaire-techsdk)
    - [SDK Installation](#sdk-installation)
    - [SDK Example Usage](#sdk-example-usage)
    - [Authentication](#authentication)
    - [Available Resources and Operations](#available-resources-and-operations)
    - [Pagination](#pagination)
    - [Error Handling](#error-handling)
    - [Server Selection](#server-selection)
- [Development](#development)
    - [Maturity](#maturity)
    - [Contributions](#contributions)

SDK Installation
----------------

[](#sdk-installation)

The SDK relies on [Composer](https://getcomposer.org/) to manage its dependencies.

To install the SDK and add it as a dependency to an existing `composer.json` file:

```
composer require "spaire-tech/spaire-php"
```

SDK Example Usage
-----------------

[](#sdk-example-usage)

### Example

[](#example)

```
declare(strict_types=1);

require 'vendor/autoload.php';

use Spaire;

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

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

);

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

Authentication
--------------

[](#authentication)

### Per-Client Security Schemes

[](#per-client-security-schemes)

This SDK supports the following security scheme globally:

NameTypeScheme`accessToken`httpHTTP BearerTo authenticate with the API the `accessToken` parameter must be set when initializing the SDK. For example:

```
declare(strict_types=1);

require 'vendor/autoload.php';

use Spaire;

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

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

);

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

### Per-Operation Security Schemes

[](#per-operation-security-schemes)

Some operations in this SDK require the security scheme to be specified at the request level. For example:

```
declare(strict_types=1);

require 'vendor/autoload.php';

use Spaire;
use Spaire\Models\Operations;

$sdk = Spaire\Spaire::builder()->build();

$request = new Operations\CustomerPortalBenefitGrantsListRequest();
$requestSecurity = new Operations\CustomerPortalBenefitGrantsListSecurity(
    customerSession: '',
);

$responses = $sdk->customerPortal->benefitGrants->list(
    request: $request,
    security: $requestSecurity
);

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

Available Resources and Operations
----------------------------------

[](#available-resources-and-operations)

Available methods### [BenefitGrants](docs/sdks/benefitgrants/README.md)

[](#benefitgrants)

- [list](docs/sdks/benefitgrants/README.md#list) - List Benefit Grants

### [Benefits](docs/sdks/benefits/README.md)

[](#benefits)

- [list](docs/sdks/benefits/README.md#list) - List Benefits
- [create](docs/sdks/benefits/README.md#create) - Create Benefit
- [get](docs/sdks/benefits/README.md#get) - Get Benefit
- [delete](docs/sdks/benefits/README.md#delete) - Delete Benefit
- [update](docs/sdks/benefits/README.md#update) - Update Benefit
- [grants](docs/sdks/benefits/README.md#grants) - List Benefit Grants

### [CheckoutLinks](docs/sdks/checkoutlinks/README.md)

[](#checkoutlinks)

- [list](docs/sdks/checkoutlinks/README.md#list) - List Checkout Links
- [create](docs/sdks/checkoutlinks/README.md#create) - Create Checkout Link
- [get](docs/sdks/checkoutlinks/README.md#get) - Get Checkout Link
- [delete](docs/sdks/checkoutlinks/README.md#delete) - Delete Checkout Link
- [update](docs/sdks/checkoutlinks/README.md#update) - Update Checkout Link

### [Checkouts](docs/sdks/checkouts/README.md)

[](#checkouts)

- [list](docs/sdks/checkouts/README.md#list) - List Checkout Sessions
- [create](docs/sdks/checkouts/README.md#create) - Create Checkout Session
- [get](docs/sdks/checkouts/README.md#get) - Get Checkout Session
- [update](docs/sdks/checkouts/README.md#update) - Update Checkout Session
- [clientGet](docs/sdks/checkouts/README.md#clientget) - Get Checkout Session from Client
- [clientUpdate](docs/sdks/checkouts/README.md#clientupdate) - Update Checkout Session from Client
- [clientConfirm](docs/sdks/checkouts/README.md#clientconfirm) - Confirm Checkout Session from Client

### [ClientInvoices](docs/sdks/clientinvoices/README.md)

[](#clientinvoices)

- [listClientInvoices](docs/sdks/clientinvoices/README.md#listclientinvoices) - List Client Invoices
- [createClientInvoice](docs/sdks/clientinvoices/README.md#createclientinvoice) - Create Client Invoice
- [getClientInvoice](docs/sdks/clientinvoices/README.md#getclientinvoice) - Get Client Invoice
- [downloadClientInvoicePdf](docs/sdks/clientinvoices/README.md#downloadclientinvoicepdf) - Download Client Invoice PDF
- [finalizeClientInvoice](docs/sdks/clientinvoices/README.md#finalizeclientinvoice) - Finalize Client Invoice
- [sendClientInvoice](docs/sdks/clientinvoices/README.md#sendclientinvoice) - Send Client Invoice
- [markClientInvoicePaid](docs/sdks/clientinvoices/README.md#markclientinvoicepaid) - Mark Client Invoice as Paid
- [voidClientInvoice](docs/sdks/clientinvoices/README.md#voidclientinvoice) - Void Client Invoice

### [CustomFields](docs/sdks/customfields/README.md)

[](#customfields)

- [list](docs/sdks/customfields/README.md#list) - List Custom Fields
- [create](docs/sdks/customfields/README.md#create) - Create Custom Field
- [get](docs/sdks/customfields/README.md#get) - Get Custom Field
- [delete](docs/sdks/customfields/README.md#delete) - Delete Custom Field
- [update](docs/sdks/customfields/README.md#update) - Update Custom Field

### [CustomerMeters](docs/sdks/customermeters/README.md)

[](#customermeters)

- [list](docs/sdks/customermeters/README.md#list) - List Customer Meters
- [get](docs/sdks/customermeters/README.md#get) - Get Customer Meter

### [CustomerPortal.BenefitGrants](docs/sdks/spairebenefitgrants/README.md)

[](#customerportalbenefitgrants)

- [list](docs/sdks/spairebenefitgrants/README.md#list) - List Benefit Grants
- [get](docs/sdks/spairebenefitgrants/README.md#get) - Get Benefit Grant
- [update](docs/sdks/spairebenefitgrants/README.md#update) - Update Benefit Grant

### [CustomerPortal.CustomerMeters](docs/sdks/spairecustomermeters/README.md)

[](#customerportalcustomermeters)

- [list](docs/sdks/spairecustomermeters/README.md#list) - List Meters
- [get](docs/sdks/spairecustomermeters/README.md#get) - Get Customer Meter

### [CustomerPortal.CustomerSession](docs/sdks/customersession/README.md)

[](#customerportalcustomersession)

- [introspect](docs/sdks/customersession/README.md#introspect) - Introspect Customer Session
- [getAuthenticatedUser](docs/sdks/customersession/README.md#getauthenticateduser) - Get Authenticated Portal User

### [CustomerPortal.Customers](docs/sdks/spairecustomers/README.md)

[](#customerportalcustomers)

- [get](docs/sdks/spairecustomers/README.md#get) - Get Customer
- [update](docs/sdks/spairecustomers/README.md#update) - Update Customer
- [listPaymentMethods](docs/sdks/spairecustomers/README.md#listpaymentmethods) - List Customer Payment Methods
- [addPaymentMethod](docs/sdks/spairecustomers/README.md#addpaymentmethod) - Add Customer Payment Method
- [confirmPaymentMethod](docs/sdks/spairecustomers/README.md#confirmpaymentmethod) - Confirm Customer Payment Method
- [deletePaymentMethod](docs/sdks/spairecustomers/README.md#deletepaymentmethod) - Delete Customer Payment Method

### [CustomerPortal.Downloadables](docs/sdks/downloadables/README.md)

[](#customerportaldownloadables)

- [list](docs/sdks/downloadables/README.md#list) - List Downloadables

### [CustomerPortal.LicenseKeys](docs/sdks/spairelicensekeys/README.md)

[](#customerportallicensekeys)

- [list](docs/sdks/spairelicensekeys/README.md#list) - List License Keys
- [get](docs/sdks/spairelicensekeys/README.md#get) - Get License Key
- [validate](docs/sdks/spairelicensekeys/README.md#validate) - Validate License Key
- [activate](docs/sdks/spairelicensekeys/README.md#activate) - Activate License Key
- [deactivate](docs/sdks/spairelicensekeys/README.md#deactivate) - Deactivate License Key

### [CustomerPortal.Members](docs/sdks/spairemembers/README.md)

[](#customerportalmembers)

- [listMembers](docs/sdks/spairemembers/README.md#listmembers) - List Members
- [addMember](docs/sdks/spairemembers/README.md#addmember) - Add Member
- [removeMember](docs/sdks/spairemembers/README.md#removemember) - Remove Member
- [updateMember](docs/sdks/spairemembers/README.md#updatemember) - Update Member

### [CustomerPortal.Orders](docs/sdks/spaireorders/README.md)

[](#customerportalorders)

- [list](docs/sdks/spaireorders/README.md#list) - List Orders
- [get](docs/sdks/spaireorders/README.md#get) - Get Order
- [update](docs/sdks/spaireorders/README.md#update) - Update Order
- [invoice](docs/sdks/spaireorders/README.md#invoice) - Get Order Invoice
- [generateInvoice](docs/sdks/spaireorders/README.md#generateinvoice) - Generate Order Invoice
- [getPaymentStatus](docs/sdks/spaireorders/README.md#getpaymentstatus) - Get Order Payment Status
- [confirmRetryPayment](docs/sdks/spaireorders/README.md#confirmretrypayment) - Confirm Retry Payment

### [CustomerPortal.Organizations](docs/sdks/spaireorganizations/README.md)

[](#customerportalorganizations)

- [get](docs/sdks/spaireorganizations/README.md#get) - Get Organization

### [CustomerPortal.Seats](docs/sdks/seats/README.md)

[](#customerportalseats)

- [listSeats](docs/sdks/seats/README.md#listseats) - List Seats
- [assignSeat](docs/sdks/seats/README.md#assignseat) - Assign Seat
- [revokeSeat](docs/sdks/seats/README.md#revokeseat) - Revoke Seat
- [resendInvitation](docs/sdks/seats/README.md#resendinvitation) - Resend Invitation
- [listClaimedSubscriptions](docs/sdks/seats/README.md#listclaimedsubscriptions) - List Claimed Subscriptions

### [CustomerPortal.Subscriptions](docs/sdks/spairesubscriptions/README.md)

[](#customerportalsubscriptions)

- [list](docs/sdks/spairesubscriptions/README.md#list) - List Subscriptions
- [get](docs/sdks/spairesubscriptions/README.md#get) - Get Subscription
- [cancel](docs/sdks/spairesubscriptions/README.md#cancel) - Cancel Subscription
- [update](docs/sdks/spairesubscriptions/README.md#update) - Update Subscription

### [CustomerPortal.Wallets](docs/sdks/wallets/README.md)

[](#customerportalwallets)

- [list](docs/sdks/wallets/README.md#list) - List Wallets
- [get](docs/sdks/wallets/README.md#get) - Get Wallet

### [CustomerSeats](docs/sdks/customerseats/README.md)

[](#customerseats)

- [listSeats](docs/sdks/customerseats/README.md#listseats) - List Seats
- [assignSeat](docs/sdks/customerseats/README.md#assignseat) - Assign Seat
- [revokeSeat](docs/sdks/customerseats/README.md#revokeseat) - Revoke Seat
- [resendInvitation](docs/sdks/customerseats/README.md#resendinvitation) - Resend Invitation
- [getClaimInfo](docs/sdks/customerseats/README.md#getclaiminfo) - Get Claim Info
- [claimSeat](docs/sdks/customerseats/README.md#claimseat) - Claim Seat

### [CustomerSessions](docs/sdks/customersessions/README.md)

[](#customersessions)

- [create](docs/sdks/customersessions/README.md#create) - Create Customer Session

### [Customers](docs/sdks/customers/README.md)

[](#customers)

- [list](docs/sdks/customers/README.md#list) - List Customers
- [create](docs/sdks/customers/README.md#create) - Create Customer
- [export](docs/sdks/customers/README.md#export) - Export Customers
- [get](docs/sdks/customers/README.md#get) - Get Customer
- [delete](docs/sdks/customers/README.md#delete) - Delete Customer
- [update](docs/sdks/customers/README.md#update) - Update Customer
- [getExternal](docs/sdks/customers/README.md#getexternal) - Get Customer by External ID
- [deleteExternal](docs/sdks/customers/README.md#deleteexternal) - Delete Customer by External ID
- [updateExternal](docs/sdks/customers/README.md#updateexternal) - Update Customer by External ID
- [getState](docs/sdks/customers/README.md#getstate) - Get Customer State
- [getStateExternal](docs/sdks/customers/README.md#getstateexternal) - Get Customer State by External ID

### [Discounts](docs/sdks/discounts/README.md)

[](#discounts)

- [list](docs/sdks/discounts/README.md#list) - List Discounts
- [create](docs/sdks/discounts/README.md#create) - Create Discount
- [get](docs/sdks/discounts/README.md#get) - Get Discount
- [delete](docs/sdks/discounts/README.md#delete) - Delete Discount
- [update](docs/sdks/discounts/README.md#update) - Update Discount

### [Disputes](docs/sdks/disputes/README.md)

[](#disputes)

- [list](docs/sdks/disputes/README.md#list) - List Disputes
- [get](docs/sdks/disputes/README.md#get) - Get Dispute

### [EventTypes](docs/sdks/eventtypes/README.md)

[](#eventtypes)

- [list](docs/sdks/eventtypes/README.md#list) - List Event Types
- [update](docs/sdks/eventtypes/README.md#update) - Update Event Type

### [Events](docs/sdks/events/README.md)

[](#events)

- [list](docs/sdks/events/README.md#list) - List Events
- [listNames](docs/sdks/events/README.md#listnames) - List Event Names
- [get](docs/sdks/events/README.md#get) - Get Event
- [ingest](docs/sdks/events/README.md#ingest) - Ingest Events

### [Files](docs/sdks/files/README.md)

[](#files)

- [list](docs/sdks/files/README.md#list) - List Files
- [create](docs/sdks/files/README.md#create) - Create File
- [uploaded](docs/sdks/files/README.md#uploaded) - Complete File Upload
- [delete](docs/sdks/files/README.md#delete) - Delete File
- [update](docs/sdks/files/README.md#update) - Update File

### [LicenseKeys](docs/sdks/licensekeys/README.md)

[](#licensekeys)

- [list](docs/sdks/licensekeys/README.md#list) - List License Keys
- [get](docs/sdks/licensekeys/README.md#get) - Get License Key
- [update](docs/sdks/licensekeys/README.md#update) - Update License Key
- [getActivation](docs/sdks/licensekeys/README.md#getactivation) - Get Activation
- [validate](docs/sdks/licensekeys/README.md#validate) - Validate License Key
- [activate](docs/sdks/licensekeys/README.md#activate) - Activate License Key
- [deactivate](docs/sdks/licensekeys/README.md#deactivate) - Deactivate License Key

### [MemberSessions](docs/sdks/membersessions/README.md)

[](#membersessions)

- [create](docs/sdks/membersessions/README.md#create) - Create Member Session

### [Members](docs/sdks/members/README.md)

[](#members)

- [listMembers](docs/sdks/members/README.md#listmembers) - List Members
- [createMember](docs/sdks/members/README.md#createmember) - Create Member
- [getMember](docs/sdks/members/README.md#getmember) - Get Member
- [deleteMember](docs/sdks/members/README.md#deletemember) - Delete Member
- [updateMember](docs/sdks/members/README.md#updatemember) - Update Member

### [Meters](docs/sdks/meters/README.md)

[](#meters)

- [list](docs/sdks/meters/README.md#list) - List Meters
- [create](docs/sdks/meters/README.md#create) - Create Meter
- [get](docs/sdks/meters/README.md#get) - Get Meter
- [update](docs/sdks/meters/README.md#update) - Update Meter
- [quantities](docs/sdks/meters/README.md#quantities) - Get Meter Quantities

### [Metrics](docs/sdks/metrics/README.md)

[](#metrics)

- [get](docs/sdks/metrics/README.md#get) - Get Metrics
- [limits](docs/sdks/metrics/README.md#limits) - Get Metrics Limits

### [Oauth2](docs/sdks/oauth2/README.md)

[](#oauth2)

- [authorize](docs/sdks/oauth2/README.md#authorize) - Authorize
- [token](docs/sdks/oauth2/README.md#token) - Request Token
- [revoke](docs/sdks/oauth2/README.md#revoke) - Revoke Token
- [introspect](docs/sdks/oauth2/README.md#introspect) - Introspect Token
- [userinfo](docs/sdks/oauth2/README.md#userinfo) - Get User Info

#### [Oauth2.Clients](docs/sdks/clients/README.md)

[](#oauth2clients)

- [create](docs/sdks/clients/README.md#create) - Create Client
- [get](docs/sdks/clients/README.md#get) - Get Client
- [update](docs/sdks/clients/README.md#update) - Update Client
- [delete](docs/sdks/clients/README.md#delete) - Delete Client

### [Orders](docs/sdks/orders/README.md)

[](#orders)

- [list](docs/sdks/orders/README.md#list) - List Orders
- [export](docs/sdks/orders/README.md#export) - Export Subscriptions
- [get](docs/sdks/orders/README.md#get) - Get Order
- [update](docs/sdks/orders/README.md#update) - Update Order
- [invoice](docs/sdks/orders/README.md#invoice) - Get Order Invoice
- [generateInvoice](docs/sdks/orders/README.md#generateinvoice) - Generate Order Invoice

### [OrganizationAccessTokens](docs/sdks/organizationaccesstokens/README.md)

[](#organizationaccesstokens)

- [list](docs/sdks/organizationaccesstokens/README.md#list) - List
- [create](docs/sdks/organizationaccesstokens/README.md#create) - Create
- [delete](docs/sdks/organizationaccesstokens/README.md#delete) - Delete
- [update](docs/sdks/organizationaccesstokens/README.md#update) - Update

### [Organizations](docs/sdks/organizations/README.md)

[](#organizations)

- [list](docs/sdks/organizations/README.md#list) - List Organizations
- [create](docs/sdks/organizations/README.md#create) - Create Organization
- [get](docs/sdks/organizations/README.md#get) - Get Organization
- [update](docs/sdks/organizations/README.md#update) - Update Organization

### [Payments](docs/sdks/payments/README.md)

[](#payments)

- [list](docs/sdks/payments/README.md#list) - List Payments
- [get](docs/sdks/payments/README.md#get) - Get Payment

### [Products](docs/sdks/products/README.md)

[](#products)

- [list](docs/sdks/products/README.md#list) - List Products
- [create](docs/sdks/products/README.md#create) - Create Product
- [get](docs/sdks/products/README.md#get) - Get Product
- [update](docs/sdks/products/README.md#update) - Update Product
- [updateBenefits](docs/sdks/products/README.md#updatebenefits) - Update Product Benefits

### [Refunds](docs/sdks/refunds/README.md)

[](#refunds)

- [list](docs/sdks/refunds/README.md#list) - List Refunds
- [create](docs/sdks/refunds/README.md#create) - Create Refund

### [Subscriptions](docs/sdks/subscriptions/README.md)

[](#subscriptions)

- [list](docs/sdks/subscriptions/README.md#list) - List Subscriptions
- [create](docs/sdks/subscriptions/README.md#create) - Create Subscription
- [export](docs/sdks/subscriptions/README.md#export) - Export Subscriptions
- [get](docs/sdks/subscriptions/README.md#get) - Get Subscription
- [revoke](docs/sdks/subscriptions/README.md#revoke) - Revoke Subscription
- [update](docs/sdks/subscriptions/README.md#update) - Update Subscription

### [Webhooks](docs/sdks/webhooks/README.md)

[](#webhooks)

- [listWebhookEndpoints](docs/sdks/webhooks/README.md#listwebhookendpoints) - List Webhook Endpoints
- [createWebhookEndpoint](docs/sdks/webhooks/README.md#createwebhookendpoint) - Create Webhook Endpoint
- [getWebhookEndpoint](docs/sdks/webhooks/README.md#getwebhookendpoint) - Get Webhook Endpoint
- [deleteWebhookEndpoint](docs/sdks/webhooks/README.md#deletewebhookendpoint) - Delete Webhook Endpoint
- [updateWebhookEndpoint](docs/sdks/webhooks/README.md#updatewebhookendpoint) - Update Webhook Endpoint
- [resetWebhookEndpointSecret](docs/sdks/webhooks/README.md#resetwebhookendpointsecret) - Reset Webhook Endpoint Secret
- [listWebhookDeliveries](docs/sdks/webhooks/README.md#listwebhookdeliveries) - List Webhook Deliveries
- [redeliverWebhookEvent](docs/sdks/webhooks/README.md#redeliverwebhookevent) - Redeliver Webhook Event

Pagination
----------

[](#pagination)

Some of the endpoints in this SDK support pagination. To use pagination, you make your SDK calls as usual, but the returned object will be a `Generator` instead of an individual response.

Working with generators is as simple as iterating over the responses in a `foreach` loop, and you can see an example below:

```
declare(strict_types=1);

require 'vendor/autoload.php';

use Spaire;

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

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

);

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

Error Handling
--------------

[](#error-handling)

Handling errors in this SDK should largely match your expectations. All operations return a response object or throw an exception.

By default an API error will raise a `Errors\APIException` exception, which has the following properties:

PropertyTypeDescription`$message`*string*The error message`$statusCode`*int*The HTTP status code`$rawResponse`*?\\Psr\\Http\\Message\\ResponseInterface*The raw HTTP response`$body`*string*The response contentWhen custom error responses are specified for an operation, the SDK may also throw their associated exception. You can refer to respective *Errors* tables in SDK docs for more details on possible exception types for each operation. For example, the `list` method throws the following exceptions:

Error TypeStatus CodeContent TypeErrors\\HTTPValidationError422application/jsonErrors\\APIException4XX, 5XX\*/\*### Example

[](#example-1)

```
declare(strict_types=1);

require 'vendor/autoload.php';

use Spaire;
use Spaire\Models\Errors;

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

try {
    $responses = $sdk->organizations->list(
        page: 1,
        limit: 10

    );

    foreach ($responses as $response) {
        if ($response->statusCode === 200) {
            // handle response
        }
    }
} catch (Errors\HTTPValidationErrorThrowable $e) {
    // handle $e->$container data
    throw $e;
} catch (Errors\APIException $e) {
    // handle default exception
    throw $e;
}
```

Server Selection
----------------

[](#server-selection)

### Select Server by Name

[](#select-server-by-name)

You can override the default server globally using the `setServer(string $serverName)` builder method when initializing the SDK client instance. The selected server will then be used as the default on the operations that use it. This table lists the names associated with the available servers:

NameServerDescription`production``https://api.spairehq.com`Production environment#### Example

[](#example-2)

```
declare(strict_types=1);

require 'vendor/autoload.php';

use Spaire;

$sdk = Spaire\Spaire::builder()
    ->setServer('production')
    ->setSecurity(
        ''
    )
    ->build();

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

);

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

### Override Server URL Per-Client

[](#override-server-url-per-client)

The default server can also be overridden globally using the `setServerUrl(string $serverUrl)` builder method when initializing the SDK client instance. For example:

```
declare(strict_types=1);

require 'vendor/autoload.php';

use Spaire;

$sdk = Spaire\Spaire::builder()
    ->setServerURL('https://api.spairehq.com')
    ->setSecurity(
        ''
    )
    ->build();

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

);

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

Development
===========

[](#development)

Maturity
--------

[](#maturity)

This SDK is in beta, and there may be breaking changes between versions without a major version update. Therefore, we recommend pinning usage to a specific package version. This way, you can install the same version each time without breaking changes unless you are intentionally looking for the latest version.

Contributions
-------------

[](#contributions)

While we value open-source contributions to this SDK, this library is generated programmatically. Any manual changes added to internal files will be overwritten on the next generation. We look forward to hearing your feedback. Feel free to open a PR or an issue with a proof of concept and we'll do our best to include it in a future release.

### SDK Created by [Speakeasy](https://www.speakeasy.com/?utm_source=spaire-tech/sdk&utm_campaign=php)

[](#sdk-created-by-speakeasy)

###  Health Score

38

—

LowBetter than 85% of packages

Maintenance100

Actively maintained with recent releases

Popularity0

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity38

Early-stage or recently created project

 Bus Factor1

Top contributor holds 68.9% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

2d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/7464f3a67e4c9a98f11e2d5d351624e4c34a97d2c39ce33cfbcccb1bcd3b2d00?d=identicon)[spaire](/maintainers/spaire)

---

Top Contributors

[![speakeasybot](https://avatars.githubusercontent.com/u/108416695?v=4)](https://github.com/speakeasybot "speakeasybot (42 commits)")[![birkjernstrom](https://avatars.githubusercontent.com/u/281715?v=4)](https://github.com/birkjernstrom "birkjernstrom (6 commits)")[![claude](https://avatars.githubusercontent.com/u/81847?v=4)](https://github.com/claude "claude (5 commits)")[![frankie567](https://avatars.githubusercontent.com/u/1144727?v=4)](https://github.com/frankie567 "frankie567 (5 commits)")[![basszurich-cyber](https://avatars.githubusercontent.com/u/246828516?v=4)](https://github.com/basszurich-cyber "basszurich-cyber (2 commits)")[![ryan-timothy-albert](https://avatars.githubusercontent.com/u/42415738?v=4)](https://github.com/ryan-timothy-albert "ryan-timothy-albert (1 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StyleLaravel Pint

Type Coverage Yes

### Embed Badge

![Health badge](/badges/spaire-tech-spaire-php/health.svg)

```
[![Health](https://phpackages.com/badges/spaire-tech-spaire-php/health.svg)](https://phpackages.com/packages/spaire-tech-spaire-php)
```

###  Alternatives

[clerkinc/backend-php

2736.3k](/packages/clerkinc-backend-php)[polar-sh/sdk

419.9k3](/packages/polar-sh-sdk)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
