Skip to content

Installation & configuration

  1. From your application directory, install the package:

    Terminal window
    composer require rayo-sms/rayo-sms-php-sdk
  2. Load Composer’s autoloader:

    require_once 'vendor/autoload.php';
  3. Create an API key in the web application under Actions → Settings and expose it to your process as SMS_API_KEY.

The API base URL for this documentation build is https://api.rayosms.com/v1.

$client = new Client(
    getenv('SMS_API_KEY'),
    'https://api.rayosms.com/v1'
);

The constructor accepts either a base URL string or an options array. A URL with or without the trailing /v1/ is normalized to the same endpoint.

use Rayo\SmsSdk\Client;
$client = new Client(getenv('SMS_API_KEY'), [
'base_url' => 'https://your-api-host.example/v1',
'timeout' => 15.0,
'connect_timeout'=> 5.0,
]);

Supported transport options include:

Option Purpose
base_url Required API origin or versioned base URL
timeout Total Guzzle request timeout; defaults to 10.0 seconds
connect_timeout Connection timeout forwarded to Guzzle
headers Additional request headers
verify Guzzle TLS certificate verification setting
handler Custom Guzzle handler, useful in tests
http_client An existing PSR-18-compatible Guzzle ClientInterface implementation

The client automatically supplies Authorization: Bearer …, Accept: application/json, and the JSON content type when required.

For the complete HTTP API, see the API reference.