Download the PHP package linkskipper/sdk without Composer
On this page you can find all versions of the php package linkskipper/sdk. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download linkskipper/sdk
More information about linkskipper/sdk
Files in linkskipper/sdk
Package sdk
Short Description Official PHP client for the Link Skipper link-resolving API.
License MIT
Homepage https://linkskipper.app
Informations about the package sdk
linkskipper/sdk
Official PHP client for the Link Skipper link-resolving API. It turns the asynchronous resolve flow into a single call.
- PHP 8.1+, zero hard dependencies (native curl). Optionally bring your own PSR-18 client.
- Typed exceptions for every API problem code and enums for tiers, statuses, and codes.
- Built-in retry with bounded exponential backoff.
Install
Quick start — resolveAndWait
resolveAndWait submits the URL, then transparently polls the job until it finishes, returning the destination. A cache hit returns instantly; a cache miss is polled for you.
Configuration
LinkSkipper::create() covers the common case. For full control, build a Config:
| Option | Default | Description |
|---|---|---|
apiKey |
(required) | Sent as Authorization: Bearer <apiKey>. |
baseUrl |
https://linkskipper.app |
API origin. |
timeoutMs |
30000 |
Per-request timeout. |
pollIntervalMs |
2000 |
Delay between job polls in resolveAndWait. |
maxWaitMs |
120000 |
Total budget for resolveAndWait before it throws TimeoutException. |
retryPolicy |
3 attempts | Backoff for network errors, 5xx, and 429. |
transport |
CurlTransport |
Swap in Psr18Transport to reuse an existing PSR-18 client. |
Bring your own PSR-18 client
API
resolve(string $url, ?string $idempotencyKey = null): ResolveResult
One-shot, non-blocking. On a cache hit the result has status === ResolveStatus::Done and a targetUrl; otherwise it is ResolveStatus::Queued with a jobId and pollUrl.
getJob(string $jobId): Job
Fetch a single job's current state.
resolveAndWait(string $url, ?string $idempotencyKey, ?int $pollIntervalMs, ?int $maxWaitMs): ResolvedLink
Resolve, then poll until the job is done, failed, or invalid. Returns the resolved link on success, throws JobFailedException on failed/invalid, and TimeoutException once maxWaitMs elapses.
account(): Account / providers(): ProviderEntry[]
Errors
Every non-2xx application/problem+json response is mapped to a typed exception. All extend ApiException, which exposes status(), errorCode(), detail(), balance(), and retryAfter().
| Code | Exception | HTTP |
|---|---|---|
invalid_request |
InvalidRequestException |
400 |
invalid_key |
InvalidKeyException |
401 |
out_of_credits |
OutOfCreditsException |
402 |
forbidden_scope |
ForbiddenScopeException |
403 |
not_found |
NotFoundException |
404 |
link_removed |
LinkRemovedException |
410 |
unsupported_link |
UnsupportedLinkException |
422 |
rate_limited |
RateLimitedException |
429 |
quota_exceeded |
QuotaExceededException |
429 |
resolve_failed |
ResolveFailedException |
502 |
provider_down |
ProviderDownException |
503 |
Non-HTTP outcomes use NetworkException (transport failure after retries), TimeoutException (poll deadline), and JobFailedException (terminal failed/invalid job). Every exception extends LinkSkipperException.
Webhooks
Pass webhook_url on a resolve and Link Skipper POSTs the result to your endpoint, signed with X-LinkSkipper-Signature: t=<unixSeconds>,v1=<hmacSha256>. Verify every delivery against your key's webhook secret with Webhook::verify, which compares the HMAC with hash_equals, enforces a freshness window (default 300s), and returns a typed WebhookEvent. Pass the raw request body string.
Retries
Network errors, 5xx, and 429 are retried with bounded exponential backoff. A Retry-After header is always honored. Other 4xx responses are never retried.
Testing
License
MIT © Link Skipper
All versions of sdk with dependencies
ext-curl Version *
ext-json Version *