PHP code example of arhinful / laravel-mnotify

1. Go to this page and download the library: Download arhinful/laravel-mnotify 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/ */

    

arhinful / laravel-mnotify example snippets


use Arhinful\LaravelMnotify\MNotify;

$notify = new MNotify();
$notify->sendQuickSMS(['0542092800', '0507455860'], 'Hello, this is a quick reminder.');

use Arhinful\LaravelMnotify\MNotify;

$notify = new MNotify('Your Sender Name');
$notify->sendQuickSMS(['0542092800', '0507455860'], 'Hello, this is a quick reminder with a named sender ID.');

$notify = new MNotify();
$notify->sendQuickSMSFromTemplate(['0542092800'], 1); // 1 = template ID in MNotify

// Send to a Group
$notify->sendGroupSMS(['group_id_1', 'group_id_2'], 'Hello Group!');

// Send to a Group from Template
$notify->sendGroupSMSFromTemplate(['group_id_1'], 1);

// Send a Scheduled SMS
$notify->setIsSchedule(true)
       ->setScheduleDate('2023-12-25 08:00:00')
       ->sendQuickSMS(['054xxxxxxx'], 'Merry Christmas!');

// Get Scheduled SMS
$notify->getScheduledSMS();

// Update Scheduled SMS
$notify->updateScheduledSMS(123, 'New message content', '2023-12-25 09:00:00');

// Quick Bulk Voice Call (using audio file)
$notify->sendQuickVoiceCall('Campaign Title', ['054xxxxxxx'], '/path/to/audio.mp3');

// Quick Bulk Voice Call (using Voice ID)
$notify->sendQuickVoiceCallFromTemplate('Campaign Title', ['054xxxxxxx'], 'voice_id_123');

// Group Bulk Voice Call (using audio file)
$notify->sendGroupVoiceCall('Campaign Title', ['group_id_1'], '/path/to/audio.mp3');

// Group Bulk Voice Call (using Voice ID)
$notify->sendGroupVoiceCallFromTemplate('Campaign Title', ['group_id_1'], 'voice_id_123');

// Scheduled Voice Call (works with all above methods)
$notify->setIsSchedule(true)
       ->setScheduleDate('2023-12-25 08:00:00')
       ->sendQuickVoiceCall('Campaign Title', ['054xxxxxxx'], '/path/to/audio.mp3');

// Initiate IVR Call
$notify->initiateIVRCall(['054xxxxxxx'], 'audio_file_id_or_path');

// Get IVR Scenarios
$notify->getIVRScenarios();

// Launch IVR Scenario
$notify->launchIVRScenario(123, ['054xxxxxxx']);

// Check SMS Balance
$notify->checkSMSBalance();

// Check Voice Balance
$notify->checkVoiceBalance();

// Register a Sender ID
$notify->registerSenderId('MyBrand', 'For OTP verification');

// Check Sender ID Status
$notify->checkSenderIdStatus('MyBrand');

// Get SMS Delivery Report
$notify->getSMSDeliveryReport('campaign_id');

// Get Specific SMS Report
$notify->getSpecificSMSDeliveryReport('message_id');

// Get Periodic SMS Report
$notify->getPeriodicSMSDeliveryReport('2023-01-01', '2023-01-31');

// Get Voice Call Report
$notify->getVoiceCallReport('campaign_id');

use Illuminate\Notifications\Notification;
use Arhinful\LaravelMnotify\NotificationDriver\MNotifyChannel;
use Arhinful\LaravelMnotify\NotificationDriver\MNotifyMessage;

class TestNotification extends Notification
{
    public function via($notifiable)
    {
        return [MNotifyChannel::class];
    }

    public function toMNotify($notifiable)
    {
        return (new MNotifyMessage())
            ->message("Hello {$notifiable->name}, your appointment is tomorrow.");
    }
}

public function routeNotificationForMNotify(): string
{
    return $this->mobile; // column containing the phone number
}
bash
php artisan vendor:publish --provider="Arhinful\\LaravelMnotify\\MNotifyServiceProvider"