PHP code example of ossycodes / nigeriabulksms

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

    

ossycodes / nigeriabulksms example snippets


'nigeriabulksms' => [
    'username'      => env('NIGERIABULKSMS_USERNAME'),
    'password'      => env('NIGERIABULKSMS_PASSWORD'),
    'sender'        => env('NIGERIABULKSMS_SENDER'),
]



namespace App;

use Illuminate\Notifications\Notifiable;
use Illuminate\Foundation\Auth\User as Authenticatable;

class User extends Authenticatable
{
    use Notifiable;

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



use NotificationChannels\Nigeriabulksms\NigeriabulksmsChannel;
use NotificationChannels\Nigeriabulksms\NigeriabulksmsMessage;

class NewsWasPublished extends Notification
{
    /**
     * Get the notification's delivery channels.
     *
     * @param  mixed  $notifiable
     * @return array
     */
    public function via($notifiable)
    {
        return [NigeriabulksmsChannel::class];
    }

    public function toNigeriabulksms($notifiable)
    {
		return (new NigeriabulksmsMessage())
                    ->setContent('Your SMS message content');

    }
}
 php
return (new NigeriabulksmsMessage("Your {$notifiable->service} was ordered!"))->setRecipients($recipients);