viodev / laravel-slack
Laravel package for sending slack message.
Installs: 2 489
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 0
Forks: 0
Open Issues: 0
Requires
- php: ^8.0
- illuminate/support: ^7.0|^8.0|^9.0|^10.0|^11.0
README
Send messages to slack from Laravel application.
Installation
composer require viodev/laravel-slack
Publish config
php artisan vendor:publish --tag="slack-config"
Usage
Basic message
Send simple message
use Viodev\Slack;
Slack::to('info')->message('My simple message');
Send blocks
Send complex message with contextual blocks
use Viodev\Slack;
// Create slack instance with title going to info channel
$slack = Slack::to('info')->title('My message title');
// Start first block with success trim
$slack->block('Key 1', 'Value 2')->success(); // Set success trim for current block
$slack->addToBlock('Key 2', 'Value 2');
$slack->addToBlock('Key 3', 'Value 3');
// Start 2nd block with error trim
$slack->newBlock('Errors', '1 error occurred');
$slack->addToBlock('Error 1', 'Exception 1')->error(); // Set error trim for current block
// Complete block and send
$slack->send();