PHP code example of deyan-ardi / ganadev-notif

1. Go to this page and download the library: Download deyan-ardi/ganadev-notif 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/ */

    

deyan-ardi / ganadev-notif example snippets


composer 

php artisan vendor:publish --provider="DeyanArdi\GanadevNotif\GanadevServiceProvider" --tag="config"

GANADEV_REPLACE_STATUS=true
GANADEV_NOTIF_DEVICE="<YOUR-DEVICE-SELECTED>"
GANADEV_NOTIF_TOKEN="<YOUR-API-TOKEN>"

'mailers' => [
    // ....
    'ganadev' => [
            'transport' => 'smtp',
            'host' => env('GANADEV_MAIL_HOST'),
            'port' => env('GANADEV_MAIL_PORT'),
            'encryption' => env('GANADEV_MAIL_ENCRYPTION'),
            'username' => env('GANADEV_MAIL_USERNAME'),
            'password' => env('GANADEV_MAIL_PASSWORD'),
            'timeout' => null,
            'local_domain' => env('GANADEV_MAIL_EHLO_DOMAIN'),
    ],
    // ....
]

MAIL_MAILER=ganadev
GANADEV_REPLACE_STATUS=true

php artisan vendor:publish --provider="DeyanArdi\GanadevNotif\GanadevServiceProvider" --tag="jobs"

use DeyanArdi\GanadevNotif\GanadevApi;

public function sendingMessageText(){
    $send_to = "[email protected]";
    $subject = "Test Subject";

    // Using Text Message
    $message = "Text Message"
    GanadevApi::sendMailMessage($send_to, $subject, $message)
}

public function sendingWithCustomView(){
    $send_to = "[email protected]";
    $subject = "Test Subject";

    // Using Laravel Views
    $message = view('emails.exampleNotification', compact('subject','send_to'))->render(); // Your custom view with render method
    GanadevApi::sendMailMessage($send_to, $subject, $message)
}


use DeyanArdi\GanadevNotif\GanadevApi;

public function sendingMessageText(){
    $send_to = "[email protected]";
    $subject = "Test Subject";
    $filename = "test.jpg"; // Filename must with file extension, support all document (docx, doc, xls, xlsx, video, audio, image, pdf dan zip)
    $link = "https://[yourdomain]/images/test.jpg"; //File must be upload on server, cant support localhost
    $mime_type ="image/jpeg"; 

    // Using Text Message
    $message = "Text Message"
    GanadevApi::sendMailMedia($send_to, $subject, $message, $filename, $link, $mime_type);
}

public function sendingWithCustomView(){
    $send_to = "[email protected]";
    $subject = "Test Subject";
    $filename = "test.jpg"; // Filename must with file extension, support all document (docx, doc, xls, xlsx, video, audio, image, pdf dan zip)
    $link = "https://[yourdomain]/images/test.jpg"; //File must be upload on server, cant support localhost
    $mime_type ="image/jpeg";

    // Using Laravel Views
    $message = view('emails.exampleNotification', compact('subject','send_to'))->render(); // Your custom view with render method
    GanadevApi::sendMailMedia($send_to, $subject, $message, $filename, $link, $mime_type)
}


use DeyanArdi\GanadevNotif\GanadevApi;

public function yourExampleFunction(){
    $send_to = "6281915003004" // Must 

use DeyanArdi\GanadevNotif\GanadevApi;

public function sendingImageVideo(){
    $send_to = "6281915003004" // Must yourdomain]/images/test.jpg"; 

    // If you choose type "image" or "video", you can add caption for message
    $caption = "Text Message"
    GanadevApi::sendWaMedia($send_to, $link, $type, $caption)
}

public function sendingAudio(){
    $send_to = "6281915003004" // Must yourdomain]/images/test.jpg"; 
    $ppt = true; // If you choose type "audio, you can add ppt configuration, the value is true = voice note | false = audio

    GanadevApi::sendWaMedia($send_to, $link, $type, $ppt)
}

public function sendingOtherMedia(){
    $send_to = "6281915003004" // Must yourdomain]/images/test.jpg"; 

    // If you choose "pdf","xls","xlsx","doc","docx","zip", you can follow this
    GanadevApi::sendWaMedia($send_to, $link, $type)
}


use DeyanArdi\GanadevNotif\GanadevApi;

public function yourExampleFunction(){
    GanadevApi::getDevice() // This method return detail of your device using in app, this request using api token and device id to get
}


{
    "status":200,
    "message":"<MESSAGE API RESPONSE HERE>"
    "data":"<DATA GET FROM SERVER API>"
}