PHP code example of forss / laravel-forss-sms-notifications

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

    

forss / laravel-forss-sms-notifications example snippets


return [
    ...

    'forss_sms' => [
        'username' => env('FORSS_SMS_USERNAME'),
        'password' => env('FORSS_SMS_PASSWORD'),
        'sender' => env('FORSS_SMS_SENDER'),
    ]
];

namespace App\Notifications;

use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Notification;
use Forss\Laravel\Notifications\ForssSms\ForssSmsMessage;
use Forss\Laravel\Notifications\ForssSms\ForssSmsChannel;
class TestSms extends Notification
{
    use Queueable;

    /**
     * Create a new notification instance.
     */
    public function __construct()
    {
        //
    }

    /**
     * Get the notification's delivery channels.
     *
     * @return array<int, string>
     */
    public function via(object $notifiable): array
    {
        return [ForssSmsChannel::class];
    }

 

    public function toForssSms() {
        return ForssSmsMessage::create('Hello World');
    }

}


class User extends Authenticatable
{
    use Notifiable;

    public function routeNotificationForForssSms()
    {
        //Return whatever phone number to use for the SMS
        return $this->phone;
    }
}