PHP code example of mmockelyn / laravel-ovh-sms

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

    

mmockelyn / laravel-ovh-sms example snippets


Illuminate\Notifications\OvhSmsChannelServiceProvider::class,

return [
  // Add configuration to third party services
  'ovh' => [
    'app_key' => env('OVH_APP_KEY', 'YOUR_APP_KEY_HERE'),
    'app_secret' => env('OVH_APP_SECRET', 'YOUR_APP_SECRET_HERE'),
    'endpoint' => env('OVH_ENDPOINT', 'OVH_ENDPOINT_HERE'),
    'consumer_key' => env('OVH_CONSUMER_KEY', 'YOUR_CONSUMER_KEY_HERE'),
    'sms_account' => env('OVH_SMS_ACCOUNT', 'sms-xxxxxxx-x'),
    'sms_default_sender' => env('OVH_SMS_DEFAULT_SENDER', 'SENDER_NAME')),
    'sms_sandbox_mode' => env('OVH_SMS_SANDBOX_MODE', false)),
  ],
];

namespace App\Notifications;

use Illuminate\Notifications\Channels\OvhSmsChannel;
use Illuminate\Notifications\Messages\OvhSmsMessage;
use Illuminate\Notifications\Notification;

class ExampleNotification extends Notification
{
    /**
     * Notification via OvhSmsChannel.
     */
    public function via($notifiable)
    {
        return [OvhSmsChannel::class];
    }

    /**
     * Your notification must implements "toOvh()"
     */
    public function toOvh($notifiable)
    {
    	return (new OvhSmsMessage('A new invoice was paid! Amount: $9.00'));
    }
}

namespace App;

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

class User extends Authenticatable
{
    use Notifiable;
    
    /**
     * Returns the user's phone number.
     */
    public function routeNotificationForOvhSms()
    {
        return $this->phone; // Ex: +33611223344
    }
}