PHP code example of djosend / php-sdk

1. Go to this page and download the library: Download djosend/php-sdk library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

djosend / php-sdk example snippets




josend\DjosendClient;

$client = new DjosendClient($_ENV['DJOSEND_API_KEY']);
$message = $client->sendMessage([
    'channel' => 'sms',
    'to' => '+2250102030405',
    'body' => 'Bonjour depuis Djosend',
], bin2hex(random_bytes(16)));

// L'envoi est asynchrone : consulter ensuite son statut.
$details = $client->getMessage($message['id']);
echo $details['status'];

$page = $client->listMessages(['page' => 1, 'limit' => 20, 'status' => 'delivered']);
$capabilities = $client->getChannelCapabilities();
$scheduled = $client->scheduleMessage([
    'to' => '+2250102030405',
    'body' => 'Rappel',
    'scheduledAt' => '2026-11-01T10:00:00Z',
    'timezone' => 'Africa/Abidjan',
], bin2hex(random_bytes(16)));
$client->cancelScheduledMessage($scheduled['id']);

$client = new DjosendClient($apiKey, 'https://sandbox.example', $guzzleClient, 2);
bash
composer