1. Go to this page and download the library: Download cloudloyalty/smsaero-client 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/ */
cloudloyalty / smsaero-client example snippets
use Feech\SmsAero\Auth\Auth;
use Feech\SmsAero\Client\ClientGuzzle;
use Feech\SmsAero\Exception\BaseSmsAeroException;
use Feech\SmsAero\SmsAero;
use Feech\SmsAero\Sms\Sms;
$auth = new Auth('email', 'pass');
$client = new ClientGuzzle($auth);
$smsAero = new SmsAero($client);
$sms1 = new Sms('79591234567', 'Тестовое сообщение', Sms::CHANNEL_TYPE_INTERNATIONAL);
$sms2 = new Sms(['79591234567', '79599876543'], 'Тестовое сообщение', Sms::CHANNEL_TYPE_DIGITAL);
try {
$smsAero->testSend($sms1); // тестовое сообщение
$smsAero->send($sms1); // отправка сообщения
$response = $smsAero->bulkSend($sms1); // массовая отправка сообщений
$responseArray = json_decode($response, true); // ответ в виде ассоциативного массива
} catch (BaseSmsAeroException $e) {
$e->getMessage();
}
use Feech\SmsAero\Auth\Auth;
use Feech\SmsAero\Client\ClientGuzzle;
use GuzzleHttp\Client;
use GuzzleHttp\HandlerStack;
// configure > $handlerStack,
]);
$auth = new Auth('email', 'pass');
$client = new ClientGuzzle($auth, $guzzleClient);
use Feech\SmsAero\Auth\Auth;
use Feech\SmsAero\Client\ClientGuzzle;
use Feech\SmsAero\Sms\Sms;
use Feech\SmsAero\SmsAeroClient;
use JMS\Serializer\SerializerBuilder;
$auth = new Auth('email', 'pass');
$client = new ClientGuzzle($auth);
$serializer = SerializerBuilder::create()->build();
$smsAero = new SmsAeroClient($client, $serializer);
$sms = Sms::toSingleNumber('79591234567', 'Тестовое сообщение', Sms::CHANNEL_TYPE_INTERNATIONAL);
$result = $smsAero->send($sms);
var_dump($result->data->status);
var_dump($result->data->cost);
bash
$ php composer.phar
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.