PHP code example of apxcde / laravel-onfon-sms

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

    

apxcde / laravel-onfon-sms example snippets


return [
    'senderId' => env('ONFON_SMS_SENDER_ID', ''),

    'api_key' => env('ONFON_SMS_API_KEY', ''),

    'client_id' => env('ONFON_SMS_CLIENT_ID', ''),

    'access_key' => env('ONFON_SMS_ACCESS_KEY', ''),
];



namespace App;

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

class User extends Authenticatable
{
    use Notifiable;

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



use Apxcde\OnfonSms\OnfonChannel;
use Apxcde\OnfonSms\OnfonMessage;

class NewsWasPublished extends Notification
{

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

    public function toOnfon($notifiable)
    {
		return (new OnfonMessage())
                    ->content('Your SMS message content');

    }
}
bash
php artisan vendor:publish --provider="Apxcde\OnfonSms\OnfonSmsServiceProvider" --tag="onfon-sms-config"