PHP code example of karix / karix-notification

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

    

karix / karix-notification example snippets


// config/karix.php

    return [
        'id'            => env('KARIX_ID'),
        'token'         => env('KARIX_TOKEN'),
        'sms_from'      => env('KARIX_FROM'),
        'whatsapp_from' => env('KARIX_WHATSAPP')
    ];

public function routeNotificationForKarix()
{
    return $this->phone;
}
 php
use KarixTech\Karix\Broadcasting\KarixMessage;
use KarixTech\Karix\Broadcasting\KarixSMSChannel;
use KarixTech\Karix\Broadcasting\KarixWhatsappChannel;


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


    public function toSmSKarix($notifiable)
    {
        return KarixMessage::create()
            ->content(['text' => 'Your message comes here']);
    }

    public function toWhatsappKarix($notifiable)
    {
        return KarixMessage::create()
            ->content([
                'text' => 'Your message comes here',
                'media' => 'url-to-media',
                'location' => [
                    'latitude' => 'the latitude here',
                    'longitude' => 'the longitude here'
                ]
            ]);
    }
}