Download the PHP package simonbackx/slack-php-webhook without Composer
On this page you can find all versions of the php package simonbackx/slack-php-webhook. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download simonbackx/slack-php-webhook
More information about simonbackx/slack-php-webhook
Files in simonbackx/slack-php-webhook
Package slack-php-webhook
Short Description Post messages to your Slack channels with this easy to use library.
License MIT
Homepage https://github.com/SimonBackx/Slack-PHP-Webhook
Informations about the package slack-php-webhook
Slack PHP Webhook
Easy to use PHP library to post messages in Slack using incoming webhook integrations.
Setup
Log in at slack.com with your team. Go to the page with all your integrations. Add a new incoming webhook.
Select a default channel to post your messages.
Confirm "Add Incoming WebHook integration" Next, you will find your WebHook URL which you need to use this library. Save it somewhere secure.
When you scroll all the way down, you get more options to change your default username, description and icon. You can overwrite these in your code.
Usage
Installation
Composer
Add Slack-PHP-Webhook to your composer.json file or run composer require simonbackx/slack-php-webhook
Alternative
Download slack.php and require/include it in your PHP file.
Simple message
Send to a channel
Send to a user
Overwriting defaults
You can overwrite the defaults on two levels: in a Slack instance (defaults for all messages using this Slack instance) or SlackMessage instances (only for the current message). These methods will not modify your root defaults at Slack.com, but will overwrite them temporary in your code.
Attachments
Create an attachment
Check out https://api.slack.com/docs/attachments for more details
pre View the result
Add buttons
Add (multiple) attachments
Short syntax
All methods support a short syntax. E.g.:
Warning
Each message initiates a new HTTPS request, which takes some time. Don't send too much messages at once if you are not running your script in a background task.