Download the PHP package ryantxr/slack-webhook without Composer
On this page you can find all versions of the php package ryantxr/slack-webhook. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package slack-webhook
Slack Webhook
This library provides a client for Slack Webhooks. With minimal code, you should be able to send a message to a channel.
This library does not try to do everything. It does one thing well.
It sends messages to Slack channels using Slack incoming webhooks.
This library uses Slack incoming webhooks. In the early days of slack, these were much easier to use than their API. It was certainly easier to set up on the Slack platform. To some extent, this is still true. There are no oauth permissions to set and the API itself is easier to understand.
Motivation
I wanted a minimal library that can send a message with minimal effort. Think of it as a paperclip. It is easy to use and requires almost zero learning to use it. It should have very little complexity and require very little thinking to get it going.
This library is compatible with service containers.
Getting Started
You can either copy the PHP files directly into your project or use composer.
Composer require command
composer require ryantxr/slack-webhook
Features
- Minimal code to send a message
- Compatible with service containers
- Easy to use to any framework or even a plain php file
Usage
Multiple Webhooks / Channels
If you need to write to multiple channels, make a webhook for each channel. Then, initialize the class like this:
Slack Communicator
This is a new class that uses the Slack conversations API instead of using webhooks. The only upside I can see is that it can be used to access multiple channels.
Here is how you use it.
Icons
It is possible to use different icons for the messages. If you don't specify one, slack will use the default for the slack app.
There are two ways to specify an icon.
- Emoji. ":rocket:"
- URL. "https://somewhere/something"
You can specify a default icon or use a different icon for each message.
Creating the communicator object
Construct a SlackCommunicator object from a container like this:
All versions of slack-webhook with dependencies
guzzlehttp/guzzle Version ^7.4 || ^6.3
psr/log Version ^1.1 || ^3.0.0
nesbot/carbon Version ^2.20