PHP code example of laravel-lib / onewaysms

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

    

laravel-lib / onewaysms example snippets


// config/services.php

'onewaysms' => [
    'username' => env('SMS_USERNAME', 'YOUR USERNAME HERE'),
    'password' => env('SMS_PASSWORD', 'YOUR PASSWORD HERE'),
    'endpoint' => env('SMS_ENDPOINT', 'https://gateway.onewaysms.com.my/api.aspx'),
    'sender' => env('SMS_SENDER', 'YOUR SENDER ID')
],


use Illuminate\Notifications\Notification;
use NotificationChannels\Onewaysms\OnewaysmsMessage;

class AccountApproved extends Notification
{
    public function via($notifiable)
    {
        return ["onewaysms"];
    }

    public function toOnewaysms($notifiable)
    {
        return (new OnewaysmsMessage)->content("Your account has been successfully approved !");
    }
}

public function routeNotificationForOnewaysms()
{
    return $this->phone;
}

Notification::route('onewaysms', '+60123456789')                      
            ->notify(new InvoicePaid($invoice));