PHP code example of oza75 / laravel-orange-sms-channel

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

    

oza75 / laravel-orange-sms-channel example snippets


// file: config/services.php

return [
    // ...others services
    
    'orange' => [
        'client_id' => env('ORANGE_CLIENT_ID'),
        'client_secret' => env('ORANGE_CLIENT_SECRET'),
    ]  
];

use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Notification;
use Oza75\OrangeSMSChannel\OrangeMessage;
use Oza75\OrangeSMSChannel\OrangeSMSChannel;

class ConfirmationNotification extends Notification
{
    use Queueable;

    /**
     * Get the notification's delivery channels.
     *
     * @param mixed $notifiable
     * @return array
     */
    public function via($notifiable)
    {
        return [OrangeSMSChannel::class];
    }
    
    // ...others method here
    
    
     /**
     * Send sms using Orange API
     * 
     * @param mixed $notifiable
     * @return OrangeMessage
     */
    public function toOrange($notifiable):OrangeMessage
    {
        return (new OrangeMessage())
                ->to('+22600000000')
                ->from('+22600000000')
                ->text('Sample text'); 
    }
}
 


return [
    /****
     * The country code that must be prepend to all phone number.
     * If the phone number already start with the `+`(plus) symbol,
     * the country code will not be applied.
     */
    'country_code' => null,

    /**
     * You may wish for all SMS sent by your application to be sent from
     * the same phone number. Here, you may specify a name and a phone number that is
     * used globally for all SMS that are sent by your application.
     */
    'from' => [
        'phone_number' => null,
        'name' => env('APP_NAME')
    ]
];
bash
php  artisan vendor:publish --provider="Oza75\OrangeSMSChannel\OrangeSMSServiceProvider"