Download the PHP package openhandle/sdk without Composer
On this page you can find all versions of the php package openhandle/sdk. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download openhandle/sdk
More information about openhandle/sdk
Files in openhandle/sdk
Package sdk
Short Description Official PHP SDK for OpenHandle
License MIT
Homepage https://openhandle.dev
Informations about the package sdk
OpenHandle PHP SDK
The official PHP client for the OpenHandle API.
Installation
The package supports PHP 8.2 and newer. It uses Guzzle for HTTP and ships typed models and PHPStan generics for every response.
Usage
Create a Test key in the Openhandle dashboard,
store it as OPENHANDLE_TEST_KEY, and create one reusable client:
The key selects the environment. oh_test_ keys return deterministic synthetic
data with a $0.000 actual charge; oh_live_ keys use real public identifiers
and normal billing. Never expose an API key in client-side code.
See the API reference for every operation.
Resource selection
The SDK follows one predictable grammar:
Only terminal operations such as get, list, search, and fetch perform
network requests. Selecting a resource is synchronous and reusable:
A profile selector accepts a username shorthand or an explicit reference:
A raw string is never treated as a platform ID. profile('12356') selects the
username 12356; profile(id: '12356') selects platform ID 12356. Numeric
reference values are rejected because platform IDs are opaque strings.
Call $openhandle->fetch($url) when you do not know which resource a supported
social URL represents. TikTok short links such as tiktok.com/t/… and
vm.tiktok.com/… are rejected by selectors and only work through fetch,
which expands them server-side.
Pass operation options as named arguments. Their positions are not part of the public API and can change when the API adds an option.
Pagination
A list or search operation returns one typed page:
next() returns null after the final page without making a request.
items() iterates lazily across pages, one request per page:
Responses
Every response preserves the public envelope. data is a typed model from the
OpenHandle\Models namespace, and metadata is available on the response:
A missing metric is null. It is never 0.
Type your own functions with the generic response and page types:
Errors and retries
The SDK throws OpenHandleError with the documented fields. Branch on code,
never on message:
Retryable failures are retried automatically with capped exponential backoff
and Retry-After support. Configure the client, or override per request:
Pass your own Guzzle client as httpClient to add proxies or middleware.
Locally invalid references throw OpenHandleReferenceError before any request
is made. ReferenceMismatchError reports a social URL that belongs to a
different platform or resource than the selector.
License
MIT
All versions of sdk with dependencies
ext-json Version *
composer-runtime-api Version ^2.2
guzzlehttp/guzzle Version ^7.9