Download the PHP package robase/sdk without Composer
On this page you can find all versions of the php package robase/sdk. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Package sdk
Short Description Official PHP client for the Robase SMS OTP and transactional SMS API
License MIT
Homepage https://robase.dev
Informations about the package sdk
Robase PHP SDK
Official PHP client for the Robase SMS OTP and transactional SMS API.
No framework dependencies — just ext-curl and ext-json. PHP 8.1+.
Install
Quick start
Client options
Every method takes a final $options array for per-call overrides:
To route requests through Guzzle or a PSR-18 client, implement
Robase\Http\Transport and pass it in — that's also how the test suite stubs
the network.
API
OTP
| Method | Endpoint |
|---|---|
$robase->otp->send($phoneNumber, $codeLength, $ttlSeconds, $metadata, $options) |
POST /v1/otp/send |
$robase->otp->verify($otpId, $code, $options) |
POST /v1/otp/verify |
$robase->otp->get($id, $options) |
GET /v1/otp/{id} |
A wrong-but-not-yet-exhausted code is not an exception — verify returns
with valid false and attemptsRemaining set:
SMS
| Method | Endpoint |
|---|---|
$robase->sms->send($phoneNumber, $message, $metadata, $options) |
POST /v1/sms/send |
$robase->sms->get($id, $options) |
GET /v1/sms/{id} |
send returns as soon as the message is queued and charged — the status is
always pending. Subscribe to the sms.delivered / sms.failed webhooks, or
poll sms->get(), to learn the outcome.
Errors
Every non-2xx response throws a subclass of Robase\Exception\RobaseException.
Catch the subclass, or inspect getType() when several types share a status:
| Exception | HTTP | getType() |
|---|---|---|
ValidationException |
400 | validation_error, invalid_phone, country_not_supported |
AuthenticationException |
401 | unauthorized |
InsufficientCreditsException |
402 | insufficient_credits |
SpamDetectedException |
403 | spam_detected |
NotFoundException |
404 | otp_not_found, sms_not_found |
ConflictException |
409 | otp_expired, otp_already_verified, max_attempts_exceeded |
RateLimitException |
429 | rate_limited — see getRetryAfter() |
ServerException |
5xx | internal_error |
ConnectionException |
— | network failure or timeout |
ValidationException is also thrown locally, before any request, for obviously
bad arguments — an empty $phoneNumber, an over-long $message.
When anti-spam blocks a message, getDetail() carries score, category and
reason.
Retries and idempotency
Network errors, 429s and 5xxs are retried with exponential backoff and full
jitter, honouring Retry-After when the server sends it. Every POST carries an
auto-generated Idempotency-Key, and a retry reuses the same key — so a retried
send replays the original response instead of charging you twice.
Pass idempotency_key in $options to reuse a key across processes. Keys are
honoured for 24 hours.
Webhooks
Robase signs every delivery with X-Robase-Signature — a hex HMAC-SHA256 of the
raw body under your webhook secret.
Events: otp.sent, otp.delivered, otp.verified, otp.expired, otp.failed,
sms.sent, sms.delivered, sms.failed, credit_balance.low,
credit_balance.exhausted, credit_balance.topped_up.
Development
License
MIT
All versions of sdk with dependencies
ext-curl Version *
ext-json Version *