1. Go to this page and download the library: Download kiwilan/notifier-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/ */
kiwilan / notifier-laravel example snippets
return [
// Default notifier client to send HTTP request, can be `stream`, `curl` or `guzzle`.
// `guzzle` is not bhook' => env('NOTIFIER_DISCORD_WEBHOOK', null),
// Default Discord username.
'username' => env('NOTIFIER_DISCORD_USERNAME', null),
// Default Discord avatar URL.
'avatar_url' => env('NOTIFIER_DISCORD_AVATAR_URL', null),
],
'mail' => [
// Use Laravel mailer instead package from `.env` file.
'laravel_override' => env('NOTIFIER_MAIL_LARAVEL_OVERRIDE', false),
// Set default subject for mail.
'subject' => env('NOTIFIER_MAIL_SUBJECT', 'Notifier'),
// Set default mailer from `.env` file.
'mailer' => env('NOTIFIER_MAIL_MAILER', 'smtp'),
'host' => env('NOTIFIER_MAIL_HOST', 'mailpit'),
'port' => env('NOTIFIER_MAIL_PORT', 1025),
'username' => env('NOTIFIER_MAIL_USERNAME', null),
'password' => env('NOTIFIER_MAIL_PASSWORD', null),
'encryption' => env('NOTIFIER_MAIL_ENCRYPTION', 'tls'),
'from_address' => env('NOTIFIER_MAIL_FROM_ADDRESS', null),
'from_name' => env('NOTIFIER_MAIL_FROM_NAME', null),
'to_address' => env('NOTIFIER_MAIL_TO_ADDRESS', null),
'to_name' => env('NOTIFIER_MAIL_TO_NAME', null),
],
'slack' => [
// Default Slack webhook URL.
'webhook' => env('NOTIFIER_SLACK_WEBHOOK', null),
],
'http' => [
// Default HTTP URL to send request.
'url' => env('NOTIFIER_HTTP_URL', null),
],
// This feature use `filament/notifications` package, not
use Kiwilan\Notifier\Facades\Journal;
Journal::debug('Hello, Journal!');
Journal::info('Hello, Journal!');
Journal::warning('Hello, Journal!');
Journal::error('Hello, Journal!');
use Kiwilan\Notifier\Facades\Journal;
Journal::info('Hello, Journal!')
->toDatabase();
use Kiwilan\Notifier\Facades\Journal;
Journal::info('Hello, Journal!')
->toNotifier('discord');
namespace App\Exceptions;
use Kiwilan\Notifier\Facades\Journal;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
use Throwable;
class Handler extends ExceptionHandler
{
public function register(): void
{
$this->reportable(function (Throwable $e) {
Journal::handler($e, toDatabase: true, toNotifier: 'mail');
});
}
}
use Kiwilan\Notifier\Facades\Notifier;
$notifier = Notifier::discord()
->username('Laravel')
->avatarUrl('https://laravel.com/img/favicon/favicon-32x32.png')
->message('Hello, Discord!');
$notifier->send();
use Kiwilan\Notifier\Facades\Notifier;
$notifier = Notifier::discord('https://discord.com/api/webhooks/1234567890/ABCDEFGHIJKLMN0123456789');
use Kiwilan\Notifier\Facades\Notifier;
$notifier = Notifier::mail()
->subject('Hello, Mail!')
->message('Hello, Mail!');
$notifier->send();