PHP code example of messagecloud / send-api-php

1. Go to this page and download the library: Download messagecloud/send-api-php 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/ */

    

messagecloud / send-api-php example snippets


use MessageCloud\Send\Authentication;

$authentication = new Authentication('your-username', 'your-password');

use MessageCloud\Send\Sms;

$message = new Sms('1234567890', 'sender', 'Hello, world!');

use MessageCloud\Send\Client;

$client = new Client($authentication);
$response = $client->send($message);

if ($response->wasSuccessful()) {
    echo "SMS sent successfully. ID: " . $response->getId();
} else {
    echo "Failed to send SMS. Status: " . $response->getStatus();
}
bash
composer 
bash
vendor/bin/php-cs-fixer fix --dry-run --stop-on-violation