Download the PHP package mwakaambrose/laravel-slack-alert without Composer
On this page you can find all versions of the php package mwakaambrose/laravel-slack-alert. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download mwakaambrose/laravel-slack-alert
More information about mwakaambrose/laravel-slack-alert
Files in mwakaambrose/laravel-slack-alert
Package laravel-slack-alert
Short Description Send a message to Slack
License MIT
Homepage https://github.com/mwakaambrose/laravel-slack-alert
Informations about the package laravel-slack-alert
Quickly send a message to Slack | Extendable for building slack bots/apps
This package can quickly send alerts to Slack. You can use this to notify yourself of any noteworthy events happening in your app.
Under the hood, a job is used to communicate with Slack. This prevents your app from failing in case Slack is down.
Installation
You can install the package via composer:
You can set a SLACK_ALERT_WEBHOOK
env variable containing a valid Slack webhook URL. You can learn how to get a webhook URL in the Slack API docs.
Alternatively, you can publish the config file with:
This is the contents of the published config file:
Usage
To send a message to Slack, simply call SlackAlert::string()
and pass it any message you want.
Using multiple webhooks
You can also use an alternative webhook, by specify extra ones in the config file.
The webhook to be used can be chosen using the to
function.
Using a custom webhooks
The to
function also supports custom webhook urls.
Formatting
Markdown
You can format your messages with Slack's markup. Learn how in the Slack API docs.
Links are formatted differently in Slack than the classic markdown structure.
Emoji's
You can use the same emoji codes as in Slack. This means custom emoji's are also supported.
Mentioning
You can use mentions to notify users and groups. Learn how in the Slack API docs.
Sending an exception
Yo can send an exception to slack by calling the exception function and passing in any instance of throwable. You will receive the message, file, line number and apps environment on slack.
More advanced
You can pass a callback function the returns an instance of SlackPhp\Blockkit\Surfaces\Message
to construct your own robust message blocks in slack. See the packaages home for more information.
Testing
Credits
- slack-php/slack-php-block-kit
- spatie/laravel-slack-alert
- Niels Vanpachtenbeke
- Freek Van der Herten
- All Contributors
License
The MIT License (MIT). Please see License File for more information.
All versions of laravel-slack-alert with dependencies
illuminate/contracts Version ^8.73|^9.0
slack-php/slack-block-kit Version 1.0
spatie/laravel-package-tools Version ^1.9.2