PHPackages                             speakeasy-api/speakeasy-client-sdk-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. [API Development](/categories/api)
4. /
5. speakeasy-api/speakeasy-client-sdk-php

ActiveLibrary[API Development](/categories/api)

speakeasy-api/speakeasy-client-sdk-php
======================================

v0.51.7(1y ago)0595MITPHPPHP ^8.2CI passing

Since Feb 10Pushed 1y ago4 watchersCompare

[ Source](https://github.com/speakeasy-api/speakeasy-client-sdk-php)[ Packagist](https://packagist.org/packages/speakeasy-api/speakeasy-client-sdk-php)[ RSS](/packages/speakeasy-api-speakeasy-client-sdk-php/feed)WikiDiscussions main Synced today

READMEChangelog (10)Dependencies (10)Versions (270)Used By (0)

speakeasy-api/speakeasy-client-sdk-php
======================================

[](#speakeasy-apispeakeasy-client-sdk-php)

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 "ian-speakeasy/speakeasy-client-sdk-php"
```

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

[](#sdk-example-usage)

### Example

[](#example)

```
declare(strict_types=1);

require 'vendor/autoload.php';

use Speakeasy\SpeakeasyClientSDK;
use Speakeasy\SpeakeasyClientSDK\Models\Shared;

$sdk = SpeakeasyClientSDK\SDK::builder()
    ->setSecurity(
        new Shared\Security(
            apiKey: '',
        )
    )
    ->build();

$request = new Shared\RemoteSource(
    inputs: [
        new Shared\RemoteDocument(
            registryUrl: 'https://productive-swine.net',
        ),
    ],
    output: new Shared\RemoteDocument(
        registryUrl: 'https://spiteful-apricot.info',
    ),
);

$response = $sdk->artifacts->createRemoteSource(
    request: $request
);

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

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

[](#authentication)

### Per-Client Security Schemes

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

This SDK supports the following security schemes globally:

NameTypeScheme`apiKey`apiKeyAPI key`bearer`httpHTTP Bearer`workspaceIdentifier`apiKeyAPI keyYou can set the security parameters through the `setSecurity` function on the `SDKBuilder` when initializing the SDK. The selected scheme will be used by default to authenticate with the API for all operations that support it. For example:

```
declare(strict_types=1);

require 'vendor/autoload.php';

use Speakeasy\SpeakeasyClientSDK;
use Speakeasy\SpeakeasyClientSDK\Models\Shared;

$sdk = SpeakeasyClientSDK\SDK::builder()
    ->setSecurity(
        new Shared\Security(
            apiKey: '',
        )
    )
    ->build();

$request = new Shared\RemoteSource(
    inputs: [
        new Shared\RemoteDocument(
            registryUrl: 'https://productive-swine.net',
        ),
    ],
    output: new Shared\RemoteDocument(
        registryUrl: 'https://spiteful-apricot.info',
    ),
);

$response = $sdk->artifacts->createRemoteSource(
    request: $request
);

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

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

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

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

[](#artifacts)

- [createRemoteSource](docs/sdks/artifacts/README.md#createremotesource) - Configure a new remote source
- [getBlob](docs/sdks/artifacts/README.md#getblob) - Get blob for a particular digest
- [getManifest](docs/sdks/artifacts/README.md#getmanifest) - Get manifest for a particular reference
- [getNamespaces](docs/sdks/artifacts/README.md#getnamespaces) - Each namespace contains many revisions.
- [getRevisions](docs/sdks/artifacts/README.md#getrevisions)
- [getTags](docs/sdks/artifacts/README.md#gettags)
- [listRemoteSources](docs/sdks/artifacts/README.md#listremotesources) - Get remote sources attached to a particular namespace
- [postTags](docs/sdks/artifacts/README.md#posttags) - Add tags to an existing revision
- [preflight](docs/sdks/artifacts/README.md#preflight) - Get access token for communicating with OCI distribution endpoints
- [setArchived](docs/sdks/artifacts/README.md#setarchived) - Set whether a namespace is archived
- [setVisibility](docs/sdks/artifacts/README.md#setvisibility) - Set visibility of a namespace with an existing metadata entry

### [auth](docs/sdks/auth/README.md)

[](#auth)

- [getAccess](docs/sdks/auth/README.md#getaccess) - Get access allowances for a particular workspace
- [getAccessToken](docs/sdks/auth/README.md#getaccesstoken) - Get or refresh an access token for the current workspace.
- [getUser](docs/sdks/auth/README.md#getuser) - Get information about the current user.
- [validateApiKey](docs/sdks/auth/README.md#validateapikey) - Validate the current api key.

### [codeSamples](docs/sdks/codesamples/README.md)

[](#codesamples)

- [generateCodeSamplePreview](docs/sdks/codesamples/README.md#generatecodesamplepreview) - Generate Code Sample previews from a file and configuration parameters.
- [generateCodeSamplePreviewAsync](docs/sdks/codesamples/README.md#generatecodesamplepreviewasync) - Initiate asynchronous Code Sample preview generation from a file and configuration parameters, receiving an async JobID response for polling.
- [get](docs/sdks/codesamples/README.md#get) - Retrieve usage snippets
- [getCodeSamplePreviewAsync](docs/sdks/codesamples/README.md#getcodesamplepreviewasync) - Poll for the result of an asynchronous Code Sample preview generation.

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

[](#events)

- [getEventsByTarget](docs/sdks/events/README.md#geteventsbytarget) - Load recent events for a particular workspace
- [getTargets](docs/sdks/events/README.md#gettargets) - Load targets for a particular workspace
- [getTargetsDeprecated](docs/sdks/events/README.md#gettargetsdeprecated) - Load targets for a particular workspace
- [post](docs/sdks/events/README.md#post) - Post events for a specific workspace
- [search](docs/sdks/events/README.md#search) - Search events for a particular workspace by any field

### [github](docs/sdks/github/README.md)

[](#github)

- [checkAccess](docs/sdks/github/README.md#checkaccess)
- [checkPublishingPRs](docs/sdks/github/README.md#checkpublishingprs)
- [checkPublishingSecrets](docs/sdks/github/README.md#checkpublishingsecrets)
- [configureCodeSamples](docs/sdks/github/README.md#configurecodesamples)
- [configureMintlifyRepo](docs/sdks/github/README.md#configuremintlifyrepo)
- [configureTarget](docs/sdks/github/README.md#configuretarget)
- [getAction](docs/sdks/github/README.md#getaction)
- [getSetup](docs/sdks/github/README.md#getsetup)
- [linkGithub](docs/sdks/github/README.md#linkgithub)
- [storePublishingSecrets](docs/sdks/github/README.md#storepublishingsecrets)
- [triggerAction](docs/sdks/github/README.md#triggeraction)

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

[](#organizations)

- [create](docs/sdks/organizations/README.md#create) - Create an organization
- [createBillingAddOns](docs/sdks/organizations/README.md#createbillingaddons) - Create billing add ons
- [createFreeTrial](docs/sdks/organizations/README.md#createfreetrial) - Create a free trial for an organization
- [deleteBillingAddOn](docs/sdks/organizations/README.md#deletebillingaddon) - Delete billing add ons
- [get](docs/sdks/organizations/README.md#get) - Get organization
- [getAll](docs/sdks/organizations/README.md#getall) - Get organizations for a user
- [getBillingAddOns](docs/sdks/organizations/README.md#getbillingaddons) - Get billing add ons
- [getUsage](docs/sdks/organizations/README.md#getusage) - Get billing usage summary for a particular organization

### [publishingTokens](docs/sdks/publishingtokens/README.md)

[](#publishingtokens)

- [create](docs/sdks/publishingtokens/README.md#create) - Create a publishing token for a workspace
- [delete](docs/sdks/publishingtokens/README.md#delete) - Delete a specific publishing token
- [get](docs/sdks/publishingtokens/README.md#get) - Get a specific publishing token
- [list](docs/sdks/publishingtokens/README.md#list) - Get publishing tokens for a workspace
- [resolveMetadata](docs/sdks/publishingtokens/README.md#resolvemetadata) - Get metadata about the token
- [resolveTarget](docs/sdks/publishingtokens/README.md#resolvetarget) - Get a specific publishing token target
- [update](docs/sdks/publishingtokens/README.md#update) - Updates the validitity period of a publishing token

### [reports](docs/sdks/reports/README.md)

[](#reports)

- [getChangesReportSignedUrl](docs/sdks/reports/README.md#getchangesreportsignedurl) - Get the signed access url for the change reports for a particular document.
- [getLintingReportSignedUrl](docs/sdks/reports/README.md#getlintingreportsignedurl) - Get the signed access url for the linting reports for a particular document.
- [uploadReport](docs/sdks/reports/README.md#uploadreport) - Upload a report.

### [schemaStore](docs/sdks/schemastore/README.md)

[](#schemastore)

- [createSchemaStoreItem](docs/sdks/schemastore/README.md#createschemastoreitem) - Create a schema in the schema store
- [getSchemaStoreItem](docs/sdks/schemastore/README.md#getschemastoreitem) - Get a OAS schema from the schema store

### [shortURLs](docs/sdks/shorturls/README.md)

[](#shorturls)

- [create](docs/sdks/shorturls/README.md#create) - Shorten a URL.

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

[](#subscriptions)

- [activateSubscriptionNamespace](docs/sdks/subscriptions/README.md#activatesubscriptionnamespace) - Activate an ignored namespace for a subscription
- [ignoreSubscriptionNamespace](docs/sdks/subscriptions/README.md#ignoresubscriptionnamespace) - Ignored a namespace for a subscription

### [suggest](docs/sdks/suggest/README.md)

[](#suggest)

- [suggest](docs/sdks/suggest/README.md#suggest) - Generate suggestions for improving an OpenAPI document.
- [suggestItems](docs/sdks/suggest/README.md#suggestitems) - Generate generic suggestions for a list of items.
- [suggestOpenAPI](docs/sdks/suggest/README.md#suggestopenapi) - (DEPRECATED) Generate suggestions for improving an OpenAPI document.
- [suggestOpenAPIRegistry](docs/sdks/suggest/README.md#suggestopenapiregistry) - Generate suggestions for improving an OpenAPI document stored in the registry.

### [workspaces](docs/sdks/workspaces/README.md)

[](#workspaces)

- [create](docs/sdks/workspaces/README.md#create) - Create a workspace
- [createToken](docs/sdks/workspaces/README.md#createtoken) - Create a token for a particular workspace
- [deleteToken](docs/sdks/workspaces/README.md#deletetoken) - Delete a token for a particular workspace
- [get](docs/sdks/workspaces/README.md#get) - Get workspace by context
- [getAll](docs/sdks/workspaces/README.md#getall) - Get workspaces for a user
- [getByID](docs/sdks/workspaces/README.md#getbyid) - Get workspace
- [getFeatureFlags](docs/sdks/workspaces/README.md#getfeatureflags) - Get workspace feature flags
- [getSettings](docs/sdks/workspaces/README.md#getsettings) - Get workspace settings
- [getTeam](docs/sdks/workspaces/README.md#getteam) - Get team members for a particular workspace
- [getTokens](docs/sdks/workspaces/README.md#gettokens) - Get tokens for a particular workspace
- [grantAccess](docs/sdks/workspaces/README.md#grantaccess) - Grant a user access to a particular workspace
- [revokeAccess](docs/sdks/workspaces/README.md#revokeaccess) - Revoke a user's access to a particular workspace
- [setFeatureFlags](docs/sdks/workspaces/README.md#setfeatureflags) - Set workspace feature flags
- [update](docs/sdks/workspaces/README.md#update) - Update workspace details
- [updateSettings](docs/sdks/workspaces/README.md#updatesettings) - Update workspace settings

Global Parameters
-----------------

[](#global-parameters)

A parameter is configured globally. This parameter may be set on the SDK client instance itself during initialization. When configured as an option during SDK initialization, This global value will be used as the default on the operations that use it. When such operations are called, there is a place in each to override the global value, if needed.

For example, you can set `workspace_id` to `''` at SDK initialization and then you do not have to pass the same value on calls to operations like `getAccessToken`. But if you want to do so you may, which will locally override the global setting. See the example code below for a demonstration.

### Available Globals

[](#available-globals)

The following global parameter is available.

NameTypeDescriptionworkspaceIdstringThe workspaceId parameter.### Example

[](#example-1)

```
declare(strict_types=1);

require 'vendor/autoload.php';

use Speakeasy\SpeakeasyClientSDK;
use Speakeasy\SpeakeasyClientSDK\Models\Operations;

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

$request = new Operations\GetAccessTokenRequest(
    workspaceId: '',
);

$response = $sdk->auth->getAccessToken(
    request: $request
);

if ($response->accessToken !== null) {
    // handle response
}
```

Retries
-------

[](#retries)

Some of the endpoints in this SDK support retries. If you use the SDK without any configuration, it will fall back to the default retry strategy provided by the API. However, the default retry strategy can be overridden on a per-operation basis, or across the entire SDK.

To change the default retry strategy for a single API call, simply provide an `Options` object built with a `RetryConfig` object to the call:

```
declare(strict_types=1);

require 'vendor/autoload.php';

use Speakeasy\SpeakeasyClientSDK;
use Speakeasy\SpeakeasyClientSDK\Models\Operations;
use Speakeasy\SpeakeasyClientSDK\Models\Shared;
use Speakeasy\SpeakeasyClientSDK\Utils\Retry;

$sdk = SpeakeasyClientSDK\SDK::builder()
    ->setSecurity(
        new Shared\Security(
            apiKey: '',
        )
    )
    ->build();

$request = new Operations\GetWorkspaceAccessRequest();

$response = $sdk->auth->getAccess(
    request: $request,
    options: Utils\Options->builder()->setRetryConfig(
        new Retry\RetryConfigBackoff(
            initialInterval: 1,
            maxInterval:     50,
            exponent:        1.1,
            maxElapsedTime:  100,
            retryConnectionErrors: false,
        ))->build()
);

if ($response->accessDetails !== null) {
    // handle response
}
```

If you'd like to override the default retry strategy for all operations that support retries, you can pass a `RetryConfig` object to the `SDKBuilder->setRetryConfig` function when initializing the SDK:

```
declare(strict_types=1);

require 'vendor/autoload.php';

use Speakeasy\SpeakeasyClientSDK;
use Speakeasy\SpeakeasyClientSDK\Models\Operations;
use Speakeasy\SpeakeasyClientSDK\Models\Shared;
use Speakeasy\SpeakeasyClientSDK\Utils\Retry;

$sdk = SpeakeasyClientSDK\SDK::builder()
    ->setRetryConfig(
        new Retry\RetryConfigBackoff(
            initialInterval: 1,
            maxInterval:     50,
            exponent:        1.1,
            maxElapsedTime:  100,
            retryConnectionErrors: false,
        )
  )
    ->setSecurity(
        new Shared\Security(
            apiKey: '',
        )
    )
    ->build();

$request = new Operations\GetWorkspaceAccessRequest();

$response = $sdk->auth->getAccess(
    request: $request
);

if ($response->accessDetails !== null) {
    // 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 `Errorors\SDKExceptioon` 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 `createRemoteSource` method throws the following exceptions:

Error TypeStatus CodeContent TypeErrorors\\Error4XXapplication/jsonErrorors\\SDKExceptioon5XX\*/\*### Example

[](#example-2)

```
declare(strict_types=1);

require 'vendor/autoload.php';

use Speakeasy\SpeakeasyClientSDK;
use Speakeasy\SpeakeasyClientSDK\Models\Errorors;
use Speakeasy\SpeakeasyClientSDK\Models\Shared;

$sdk = SpeakeasyClientSDK\SDK::builder()
    ->setSecurity(
        new Shared\Security(
            apiKey: '',
        )
    )
    ->build();

try {
    $request = new Shared\RemoteSource(
        inputs: [
            new Shared\RemoteDocument(
                registryUrl: 'https://productive-swine.net',
            ),
        ],
        output: new Shared\RemoteDocument(
            registryUrl: 'https://spiteful-apricot.info',
        ),
    );

    $response = $sdk->artifacts->createRemoteSource(
        request: $request
    );

    if ($response->statusCode === 200) {
        // handle response
    }
} catch (Errorors\ErrorThrowable $e) {
    // handle $e->$container data
    throw $e;
} catch (Errorors\SDKExceptioon $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`prod``https://api.prod.speakeasy.com`#### Example

[](#example-3)

```
declare(strict_types=1);

require 'vendor/autoload.php';

use Speakeasy\SpeakeasyClientSDK;
use Speakeasy\SpeakeasyClientSDK\Models\Shared;

$sdk = SpeakeasyClientSDK\SDK::builder()
    ->setServer('prod')
    ->setSecurity(
        new Shared\Security(
            apiKey: '',
        )
    )
    ->build();

$request = new Shared\RemoteSource(
    inputs: [
        new Shared\RemoteDocument(
            registryUrl: 'https://productive-swine.net',
        ),
    ],
    output: new Shared\RemoteDocument(
        registryUrl: 'https://spiteful-apricot.info',
    ),
);

$response = $sdk->artifacts->createRemoteSource(
    request: $request
);

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 Speakeasy\SpeakeasyClientSDK;
use Speakeasy\SpeakeasyClientSDK\Models\Shared;

$sdk = SpeakeasyClientSDK\SDK::builder()
    ->setServerURL('https://api.prod.speakeasy.com')
    ->setSecurity(
        new Shared\Security(
            apiKey: '',
        )
    )
    ->build();

$request = new Shared\RemoteSource(
    inputs: [
        new Shared\RemoteDocument(
            registryUrl: 'https://productive-swine.net',
        ),
    ],
    output: new Shared\RemoteDocument(
        registryUrl: 'https://spiteful-apricot.info',
    ),
);

$response = $sdk->artifacts->createRemoteSource(
    request: $request
);

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

Summary
-------

[](#summary)

Speakeasy API: The Subscriptions API manages subscriptions for CLI and registry events

For more information about the API: [The Speakeasy Platform Documentation](/docs)

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

[](#table-of-contents)

- [speakeasy-api/speakeasy-client-sdk-php](#speakeasy-apispeakeasy-client-sdk-php)
    - [SDK Installation](#sdk-installation)
    - [SDK Example Usage](#sdk-example-usage)
    - [Authentication](#authentication)
    - [Available Resources and Operations](#available-resources-and-operations)
    - [Global Parameters](#global-parameters)
    - [Retries](#retries)
    - [Error Handling](#error-handling)
    - [Server Selection](#server-selection)

### 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. Feel free to open a PR or a Github issue as a proof of concept and we'll do our best to include it in a future release !

### SDK Created by [Speakeasy](https://docs.speakeasyapi.dev/docs/using-speakeasy/client-sdks)

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

###  Health Score

37

—

LowBetter than 81% of packages

Maintenance45

Moderate activity, may be stable

Popularity11

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity68

Established project with proven stability

 Bus Factor1

Top contributor holds 86.2% 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

Every ~4 days

Total

187

Last Release

423d ago

PHP version history (3 changes)v0.0.2PHP &gt;=8.1.0

v0.36.2PHP ^8.1

v0.43.0PHP ^8.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/439b4090b0838ff2c2014c11843e2d90fb8cc34c48c8e78cc2d3dd0c109541e8?d=identicon)[tristan@speakeasyapi.dev](/maintainers/tristan@speakeasyapi.dev)

---

Top Contributors

[![speakeasybot](https://avatars.githubusercontent.com/u/108416695?v=4)](https://github.com/speakeasybot "speakeasybot (187 commits)")[![idbentley](https://avatars.githubusercontent.com/u/403209?v=4)](https://github.com/idbentley "idbentley (15 commits)")[![TristanSpeakEasy](https://avatars.githubusercontent.com/u/108070248?v=4)](https://github.com/TristanSpeakEasy "TristanSpeakEasy (14 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/speakeasy-api-speakeasy-client-sdk-php/health.svg)

```
[![Health](https://phpackages.com/badges/speakeasy-api-speakeasy-client-sdk-php/health.svg)](https://phpackages.com/packages/speakeasy-api-speakeasy-client-sdk-php)
```

###  Alternatives

[laravel/framework

The Laravel Framework.

34.8k543.8M20.1k](/packages/laravel-framework)[polar-sh/sdk

4527.8k9](/packages/polar-sh-sdk)[clerkinc/backend-php

3493.3k](/packages/clerkinc-backend-php)[tencentcloud/tencentcloud-sdk-php

TencentCloudApi php sdk

3741.3M47](/packages/tencentcloud-tencentcloud-sdk-php)[dnsimple/dnsimple

The DNSimple API client for PHP.

11222.7k1](/packages/dnsimple-dnsimple)[eslazarev/wildberries-sdk

Wildberries OpenAPI clients (generated).

273.0k](/packages/eslazarev-wildberries-sdk)

PHPackages © 2026

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