PHP code example of shafimsp / laravel-sms-notification-channel

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

    

shafimsp / laravel-sms-notification-channel example snippets


return [
    /*
    |--------------------------------------------------------------------------
    | The default SMS Driver
    |--------------------------------------------------------------------------
    |
    | The default sms driver to use as a fallback when no driver is specified
    | while using the SMS.
    |
    | Supported: "nexmo", "log", "null"
    |
    */
    'default' => env('SMS_DRIVER', 'log'),

    /*
    |--------------------------------------------------------------------------
    | Log Channel
    |--------------------------------------------------------------------------
    |
    | If you are using the "log" driver, you may specify the logging channel
    | if you prefer to keep mail messages separate from other log entries
    | for simpler reading. Otherwise, the default channel will be used.
    |
    */
    'log_channel' => env('SMS_LOG_CHANNEL'),
];

    /**
     * Get the notification's delivery channels.
     *
     * @param  mixed  $notifiable
     * @return array
     */
    public function via($notifiable)
    {
        return ['sms'];
    }

    /**
     * Get the SMS representation of the notification.
     *
     * @param  mixed  $notifiable
     * @return string
     */
    public function toSms()
    {
        return 'Your message content goes here';
    }

    /**
     * Get the notification's delivery channels.
     *
     * @param  mixed  $notifiable
     * @return string
     */
    public function toSms()
    {
        return (new SmsMessage())
            ->content('Your message goes here');
    }

    /**
     * Get the notification's delivery channels.
     *
     * @param  mixed  $notifiable
     * @return string
     */
    public function toSms()
    {
        return (new SmsMessage())
            ->content('Your message goes here')
            ->unicode();
    }

    /**
     * Get the notification's delivery channels.
     *
     * @param  mixed  $notifiable
     * @return string
     */
    public function toSms()
    {
        return (new SmsMessage())
            ->content('Your message goes here')
            ->unicode();
    }

     /**
     * Route notifications for the Nexmo channel.
     *
     * @param  \Illuminate\Notifications\Notification  $notification
     * @return string
     */
    public function routeNotificationForSms($notification)
    {
        return $this->phone;
    }

\Shafimsp\SmsNotificationChannel\Facades\Sms::driver('nexmo')
        ->content("Message content goes here")
        ->to('MOBILE_NUMBER_TO_SENT_TO')
        ->send();
bash
php artisan vendor:publish --provider="Shafimsp\SmsNotificationChannel\SmsServiceProvider" --tag="config"