1. Go to this page and download the library: Download signalads-co/laravel 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/ */
signalads-co / laravel example snippets
composer
"signalads/laravel": "*"
$ composer update
use Signalads\Laravel\Facade\Signalads;
try {
// call SignalAdsApi function
}
catch(\SignalAds\Exceptions\ApiException $e){
// در صورتی که خروجی وب سرویس 200 نباشد این خطا رخ می دهد
echo $e->errorMessage();
}
catch(\SignalAds\Exceptions\HttpException $e){
// در زمانی که مشکلی در برقرای ارتباط با وب سرویس وجود داشته باشد این خطا رخ می دهد
echo $e->errorMessage();
}
$sender = "10004346"; //This is the Sender number if not set load from config
$message = "خدمات پیام کوتاه سیگنال"; //The body of SMS
$receptor = "09191234567"; //Receptors numbers
$result = Signalads::send($receptor, $message, $sender);
$sender = "10004346"; //This is the Sender number if not set load from config
$message = "خدمات پیام کوتاه سیگنال"; //The body of SMS
$receptors = array("09361234567","09191234567"); //Receptors numbers
$result = Signalads::sendGroup($receptors, $message, $sender);
$sender = "10004346"; //This is the Sender number if not set load from config
$patternId = 123;
$patternParams = ["param 1", "param 2"];
$receptors = array("09361234567","09191234567"); //Receptors numbers
$result = Signalads::sendPattern($patternId, $patternParams, $receptors, $sender);
class SendOtp extends SignaladsNotification
{
public function __construct(Otp $otp)
{
$this->otp = $otp;
}
public function toSignalads($notifiable)
{
return (new SignaladsMessage("your verify code is $otp->code"))
->from('10004346');
}
}
class Otp extends Model
{
use Notifiable;
public function routeNotificationForSignalads($driver, $notification = null)
{
return $this->number;
}
}
class SendWithPattern extends SignaladsBaseNotification
{
public function toSignalads(mixed $notifiable): SignaladsMessage
{
return (new SignaladsMessage(''))
->patternId(123412341234)
->patternParams([1,2])
->sendMethod(SignalSendMethods::sendPattern);
}
}
class SendWithPattern extends SignaladsBaseNotification
{
public function toSignalads(mixed $notifiable): SignaladsMessage
{
return (new SignaladsMessage('پیام تست'))
->to(["09191234567", "09191234567"])
->sendMethod(SignalSendMethods::sendGroup);
}
}