PHP code example of gl-package / notification-manager

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

    

gl-package / notification-manager example snippets


use GlPackage\NotificationManager\Notifications\TelegramNotification;

$data = [
    'message' => "<b>Hello World!</b> Click the button below:",
    'buttons' => [
        [
            ['text' => 'Click Me', 'url' => 'https://example.com'] // Optional , else pass [] array
        ]
    ]
];

$telegram = new TelegramNotification();
$telegram->quickSend($data); // For quick send
// or
$telegram->queueSend($data); // For queued send


use GlPackage\NotificationManager\Notifications\EmailNotification;
use Faker\Factory as Faker;

$data = [
    'to_address' => Faker::create()->email,
    'subject' => 'Welcome to Our Service',
    'body' => 'Thank you for signing up! Here are some details about your account.',
    'view' => 'notificationmanager.testmail', // Optional view page location
    'attachments' => [], // Optional attachments array
    'name' => 'Hello, Ajay' // Optional parameters
];

$mail = new EmailNotification();
$mail->send($data); // Send mail via queue
// Ensure to run: php artisan queue:work or use Supervisor

use GlPackage\NotificationManager\Notifications\WhatsAppNotification;

$data = [
    'mobile' => '91908*******',
    'template' => 'hello_world', // Sample template
    'parameters' => [ // Optional
        [
            "type" => "text",
            "text" => "Test"
        ],
        [
            "type" => "text",
            "text" => "1200"
        ]
    ],
    'buttons' => [ // Optional
        [
            "type" => "text",
            "text" => "16"
        ]
    ]
];

$whatsapp = new WhatsAppNotification();
$whatsapp->send($data); // Send WhatsApp message via queue

// Ensure to run: php artisan queue:work or use Supervisor

sh
    php artisan migrate
    
sh
    php artisan vendor:publish --provider="GlPackage\NotificationManager\Providers\NotificationManagerServiceProvider" --tag=notificationmanager-views
    php artisan vendor:publish --provider="GlPackage\NotificationManager\Providers\NotificationManagerServiceProvider" --tag=notificationmanager-controllers
    php artisan vendor:publish --provider="GlPackage\NotificationManager\Providers\NotificationManagerServiceProvider" --tag=notificationmanager-routes
    
sh
    php artisan queue:table
    php artisan migrate
    php artisan queue:work