frf / discord-notification
Send message to webhook discord channel
1.0.14
2021-05-11 22:30 UTC
Requires
- php: ^7.2.5|^8.0
- guzzlehttp/guzzle: ^7.3
README
Send messsage to discord hook
Project created to decouple the sending of messages to disagree, and in this way keep the project without fixed dependency. Sending messages through the discord hook can facilitate the communication of errors, warn when a tariff ends, among many benefits.
Features
- Send message to channel discord with hook
Future Features
- Send message to multiple channel discord with hook
- Integration Notification Laravel
Installation
Laravel Discord Message requires PHP Laravel v8+ to run.
Install the package
composer require frf/discord-notification
After install - Create Discord Hook
Open your channel config and create integration
Add name your hook and choose your channel
Put end of file .env
configuration link hook in your .env
DISCORD_HOOK=https://discord.com/api/webhooks/4334343/XaFx43434343lGHYvQHoQO0ykhGRibx3w
Exemple to use command line
php artisan discord:send_message Teste php artisan discord:send_message Teste warning
Exemple to use injection service,
Remembering that there is no better place on the controller 😅, I put it just as a practical example
<?php use Frf\DiscordNotification\Services\DiscordService; use Illuminate\Support\Facades\Route; Route::get('/', function (DiscordService $discordService) { $discordService ->title('Mensagem Teste') ->description('Descricao') ->footer('Footer') ->success() ->timestamp(Carbon::now()) ->send(); return view('welcome'); });
Result
License
MIT
Free Software, Hell Yeah!