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.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

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

PHP Build Version
Package Version
Requires php Version >=8.1
ext-curl Version *
ext-json Version *
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package robase/sdk contains the following files

Loading the files please wait ...