PHP code example of ibnuhalimm / laravel-thai-bulk-sms
1. Go to this page and download the library: Download ibnuhalimm/laravel-thai-bulk-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/ */
ibnuhalimm / laravel-thai-bulk-sms example snippets
use Ibnuhalimm\LaravelThaiBulkSms\Facades\ThaiBulkSms;
// Send the sms to single recipient
$phoneNumber = '+6612345678';
$message = 'Hi, our message here.';
ThaiBulkSms::send($phoneNumber, $message);
// Send the sms to multiple phone number
$phoneNumber = [
'+6612345678',
'+6690111213',
];
$message = 'Hi, our message here.';
ThaiBulkSms::send($phoneNumber, $message);
use Ibnuhalimm\LaravelThaiBulkSms\ThaiBulkSmsChannel;
use Ibnuhalimm\LaravelThaiBulkSms\ThaiBulkSmsMessage;
use Illuminate\Notifications\Notification;
class VerifyMobileNumber extends Notification
{
public function via()
{
return [ThaiBulkSmsChannel::class];
}
public function toThaiBulkSms($notifiable)
{
return (new ThaiBulkSmsMessage())
->message("Your OTP to complete the registration is {$this->otp}");
}
}
public function routeNotificationForThaiBulkSms()
{
return $this->phone;
}
...
public function toThaiBulkSms($notifiable)
{
return (new ThaiBulkSmsMessage())
->message("Your OTP to complete the registration is {$notifiable->otp}")
->to($notifiable->phone); // add this
}
...