PHP code example of yna / laravel-b-sms

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

    

yna / laravel-b-sms example snippets


// config/app.php
'providers' => [
    ...
    Yna\BSms\BSmsServiceProvider::class,
],

// config/services.php
...
'bsms' => [
    'user' => env('BSMS_USER'),
    'password' => env('BSMS_PASSWORD'),
    'sender' => env('BSMS_SENDER')
],
...

use Illuminate\Notifications\Notification;
use Yna\PortToSms\PortToSmsMessage;
use Yna\PortToSms\PortToSmsChannel;

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

    public function toBSms($notifiable)
    {
        return BSmsMessage::create("Task #{$notifiable->id} is complete!");
    }
}

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