1. Go to this page and download the library: Download asanak/laravel-sms-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/ */
asanak / laravel-sms-client example snippets
use Asanak\Sms\Facade\AsanakSmsFacade as AsanakSms;
public function send()
{
try {
$data = AsanakSms::sendSms(
source: '9821XXXXX',
destination: '09120000000',
message: 'کد تایید شما: 123456',
send_to_black_list: 1
);
//Log or save $data as messageIds for get message status report
} catch (\Throwable $e) {
echo $e->getMessage();
}
}
use Asanak\Sms\Facade\AsanakSmsFacade as AsanakSms;
try {
$data = AsanakSms::template(
template_id: 1234,
parameters: ['code' => 67890],
destination: '09120000000'
);
//Log or save $data as messageIds for get message status report
} catch (\Throwable $e) {
echo $e->getMessage();
}
use Asanak\Sms\Facade\AsanakSmsFacade as AsanakSms;
try {
$data = AsanakSms::msgStatus(['msgid1', 'msgid2']);
} catch (\Throwable $e) {
echo $e->getMessage();
}