PHP code example of rene-roscher / clicksend-laravel

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

    

rene-roscher / clicksend-laravel example snippets


class TestNotificationClickSend extends Notification
{
    /**
     * Get the notification's delivery channels.
     *
     * @return array<int, string>
     */
    public function via(object $notifiable): array
    {
        return ['clicksend-voice', 'clicksend-sms']; // All channels are automatically registered by default
    }

    /**
     * Get the mail representation of the notification.
     */
    public function toClicksendVoice(object $notifiable) // Voice
    {
        return ClickSendVoiceMessage::create(
            message: 'Your Verification Code is: 1234 - I repeat: 1234 - Goodbye!',
            to: $notifiable->phone_number
        );
        // Or
        return 'Your Verification Code is: 1234 - I repeat: 1234 - Goodbye!';
    }

    public function toClicksendSms(object $notifiable) // SMS
    {
        // Default
        return ClickSendSmsMessage::create(
            message: 'Your Verification was approved. Thank you! 🎉',
            to: $notifiable->phone_number
        );

        // Or a single message
        return 'Your Verification was approved. Thank you! 🎉';

        // Or multiple messages at once
        return ClickSendSmsMessage::create(
            message: 'Your Verification was approved. Thank you! 🎉',
            to: $notifiable->phone_number
        )->addMessage(
            message: 'Welcome to our platform! 🎉',
            to: $notifiable->phone_number
        );
    }

}