PHP code example of dmn / emessage

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

    

dmn / emessage example snippets




return [
    'base_uri' => env('EMESSAGE_BASE_URI', 'https://ws-live.emessage.com/'),
    'api_key' => env('EMESSAGE_API_KEY'),
    'guzzle' => [],
];



namespace Dmn\Emessage\Examples;

use Dmn\Emessage\Channels\Emessage;
use Dmn\Emessage\Messages\EmessageMessage;
use Illuminate\Notifications\Notification;

class SmsNotification extends Notification
{
    /**
     * Get the notification channels.
     *
     * @param  mixed  $notifiable
     * @return array|string
     */
    public function via($notifiable)
    {
        return [Emessage::class];
    }

    /**
     * Get Emessage message
     *
     * @param mixed $notifiable
     *
     * @return EmessageMessage
     */
    public function toEmessage($notifiable): EmessageMessage
    {
        return (new EmessageMessage())
            ->setMobileNumber($notifiable['mobile_number'])
            ->setMessage('This is a sample sms from package channel emessage');
    }
}