mnsr / laravel-slack
Package makes send notifications to slack channel easier
Installs: 9
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Forks: 0
pkg:composer/mnsr/laravel-slack
Requires
- laravel/framework: ^6.0|^7.0|^8.0|^9.0
This package is not auto-updated.
Last update: 2025-10-20 10:08:36 UTC
README
Create slack webhook
Slack API webhook official documentation
Add variables to .env
# Add if you have a proxy (Ex. http://192.168.1.1:3128)
PROXY_URL=
# Get from Slack Api
LOG_SLACK_WEBHOOK_URL=https://hooks.slack.com/services/xxx/yyy/zzz
# Your default slack channel
SLACK_DEFAULT_CHANNEL="my_channel"
Then clear config
php artisan config:cache
Use functions directly in your code
$msg // required parameter
$title // optional parameter
slack_emergency($msg, $title);
slack_alert($msg, $title);
slack_critical($msg, $title);
slack_error($msg, $title);
slack_warning($msg, $title);
slack_notice($msg, $title);
slack_info($msg, $title);
slack_debug($msg, $title);
Example
try{
    // My Code xx ...
    slack_info('code xx finished successfully ..', 'my lovely title');
    // My Code yyy ...
}catch (Exception $exception){
    slack_error($exception->getMessage());
}