PHP code example of w3-devmaster / laravel-notibot

1. Go to this page and download the library: Download w3-devmaster/laravel-notibot 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/ */

    

w3-devmaster / laravel-notibot example snippets


use W3Devmaster\Notibot\Sender\Email;

public function email()
{
    $email = new Email();
    $send = $email
        ->to('[email protected]')
        ->subject('test')
        ->sender('[email protected]')
        ->content([
            'title' => 'Email Title',
            'message' => 'Email Message',
            'footer' => 'Email Footer',
        ])
        ->exec();
    return $send;
}

use W3Devmaster\Notibot\Sender\LineNotify;

public function line() {
    $line = new LineNotify();

    $send = $line->to('<your line notify token>')
            ->message('test message')
            ->delay(true)
            ->delayTime('2023-11-10 15:00')
            ->exec();

    return $send;
}

use W3Devmaster\Notibot\Notibot;
use W3Devmaster\Notibot\Sender\Email;
use W3Devmaster\Notibot\Sender\LineNotify;


public function create()
{
    $email = new Email();
    $email->to('[email protected]')
        ->subject('test')
        ->sender('[email protected]')
        ->content([
            'title' => 'Email Title',
            'message' => 'Email Message',
            'footer' => 'Email Footer',
        ]);

    $line = new LineNotify();

    $line->to('<your line notify token>')
        ->message('test message');

    $tranx = [
        'type' => 'onetime', // onetime | repeat
        'start' => '2023-11-10 15:00',
        'end' => '2023-11-10 15:00', // requried if type = repeat
        'next' => 2, // minute | requried if type = repeat
    ];

    $notibot = Notibot::create($tranx,$email,$line);

    return $notibot;
}

$notibot = new Notibot();
// Get all
$transactions = $notibot->transactions();

// Pages seperate
$transactions = $notibot->transactions($perPage,$page);

$notibot = new Notibot();
// Get id from other transaction : response->data
$transaction = $notibot->transaction($transactionId); 

use W3Devmaster\Notibot\Notibot;
use W3Devmaster\Notibot\Sender\Email;
use W3Devmaster\Notibot\Sender\LineNotify;


public function update($transactionId)
{
    $email = new Email();
    $email->to('[email protected]')
        ->subject('test')
        ->sender('[email protected]')
        ->content([
            'title' => 'Email Title',
            'message' => 'Email Message',
            'footer' => 'Email Footer',
        ]);

    $line = new LineNotify();
    $line->to('<your line notify token>')
        ->message('test message');

    $tranx = [
        'type' => 'onetime', // onetime | repeat
        'start' => '2023-11-10 15:00',
        'end' => '2023-11-10 15:00', // requried if type = repeat
        'next' => 2, // minute | requried if type = repeat
    ];

    $notibot = Notibot::update($transactionId,$tranx,$email,$line); 

    return $notibot;
}

$notibot = new Notibot();
// Get id from other transaction : response->data
$notibot->delete($transactionId);

$notibot = new Notibot();
// Get all logs
$logs = $notibot->logs();

// Pages seperate
$logs = $notibot->logs($perPage,$page);

$notibot = new Notibot();
// Log id from send logs
$logs = $notibot->log($logsId);
bash
php artisan vendor:publish --provider="W3Devmaster\Notibot\NotibotServiceProvider"