PHP code example of samrap / teleapi-sms

1. Go to this page and download the library: Download samrap/teleapi-sms 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/ */

    

samrap / teleapi-sms example snippets


use Teleapi\Sms\Client;

$client = new Client('api_token');

use Teleapi\Sms\Client;

// Some code to create our HTTP client...

$client = new Client('api_token', $httpClient);

use Teleapi\Sms\Message;

$to = '7148675309';
$from = '7141234567';
$text = 'Welcome to our amazing product!';
$message = new Message($to, $from, $text);

$client->send($message);

$client->send($message);

if ($message->sent()) {
    echo 'Successfully sent message!';
}

use Teleapi\Sms\Client;

// Some code to create our HTTP client...

$client = new Client('api_token', $httpClient);
$message = new Message(
    '7148675309',
    '7141234567',
    'Welcome to our amazing product!'
);

$client->send($message);

if ($message->sent()) {
    echo 'Successfully sent message!';
}