Author: Alexander Chibrikin
Updated on: 2019-11-13
Posted on: 2019-11-13
Package: PHP Slack Message
If you use Slack in your team for monitoring, sending notifications, commands or for other purposes you may be interested in a PHP package that can automate the processes that involve your work with Slack.
There are some PHP packages that were popular but they seem to no longer be developed or supported.
Read this article to learn how you can use this PHP Slack Message package to take advantage of the Slack resources, as well how you can collaborate to benefit the community of PHP developers that use Slack.
What is Slack
I think many of us developers use Slack in your teams for simplifying the communication about the work in a project. So, for the other developers that are not yet familiar with Slack, be aware that for helping developers to collaborate better, Slack is great and helpful.
You can create several channels in it for different departments or/and different subteams, for example, for frontend, backend, devops, etc..
You can connect many kinds of other services that are already implemented as integrations, for instance: Bitbucket, GitHub, GitLab, Jira, Trello, etc.. All services that you could think about, probably are already supported and there is an integration.
And if not, there is great API with help of which you can put into effect all your ideas easily. And most likely you've already implemented something for Slack at least once.
Also you can connect applications or so-called bots and for example quickly get instant voting or weather summary. And you can also write your own.
Besides you can write a simple small API in your application that will receive commands from Slack and do some actions. In one of my projects I implement many abilities of admin panel via Slack commands. And it turned out very handy.
However we more often use Slack API for monitoring (severs/logs/) and for notifying about some events in our application.
The Older Package
If you use Slack in your team for monitoring, notifications, commands or other purposes you primarily like me try to find existing package that easy to install and use. And like me find great and popular package
This package at the moment has about 2 millions installs, almost 1000 stars and 150 forks. This package has 73 dependent packages, including all kinds of integrations with different frameworks (Laravel, Symfony, Yii, etc.) and automations like PHP-CI. Lets consent that's fairly well.
This package supports PHP 5.4 or above, including PHP 7. It has only
guzzlehttp/guzzle in its own dependencies, and herewith it can use any of versions
~6.0|~5.0|~4.0, which is a good thing when it comes about compatibility with other packages. It has auto builds on Travis and good quality score on Scrutinizr. This is great.
Other than that this package has several pre-releases (
0.3.0) and a track record in stable -
1.7.0. On GitHub there are bug-reports/feature-requests and pull-requests from third-party developers (contributors), that means some community was already formed, which helps to contribute and develop.
Running a quick look through the documentation you can immediately understand how to use it. All things easy and clear.
Great! What else is needed to be happy with this package? Lets see how to install and use. In a couple of minutes to create
incoming webhook in Slack admin, copy here URL to hook, paste into config, a couple of lines of code, and in a few minutes you get your first test message in your Slack. Perfect!
That is how it was with me. At that moment I needed not much just simple message-notification in specific channel. Having tied up some loose ends in my code and sliced and diced the project I was happy enough to forget it.
However, after some time I needed some more functionality and several buttons to be added into message for the simplify the flow, so I could interact with application directly from the message. Just tired every time to switch to browser, open new tab, go into admin, sign in,.. you know. Its more handy to click one of the provided buttons.
And here I am in for a surprise.
First I found out that the necessary version that should work did not have a stable release (
1.7.0), and exists only in
master. Ok, not so much. I just get for a time with unstable and than as stable is released will switch to it.
After the implementation the needed features, I saw it did not work and there was a bug in package. Ok, bugs are everywhere and they are part of our life, especially in an unstable version.
At that moment I thought that it would be good to report on GitHub, but I decided to look at the code.
I open the sources and found the reason quickly enough. OK, if so, I can send the pull-request. So, I went to GitHub to search if this bug was already reported. And it was. In some kind... In one of issues for enhancement I found a comment, that described that problem. And then I noticed the date...
commented on Jul 6, 2016.
Something is wrong. And when was the last commit? Found it:
Latest commit 89ff7b2 on Feb 23, 2017. And the only thing in this commit is the addition into
README.md "Note: this package is no longer being actively maintained.". What a surprise!!!
Project is abandoned and for a long time. And after all, I already have used it in three projects. If you also actively use Slack in your projects, then I think you have the same package, and possibly you faced with similar problems.
This package is good, clear, and handy, but didn't pan out a bit. I had to look for alternatives. But as turned out, there are no alternatives. Write own from scratch? I do not want to do that.
The New package Based on alek13/slack
Well! I decided to revive the project and support it. I created the fork
alek13/slack, created build on Travis, connected Scrutinizr and dependencies auto-checker. Also I created workspace in Slack for contributors and in case someone has questions about package and its usage.
At the moment there is some good work in the
master branch already, that was not released yet. Some of them I already picked from git history and released
1.8.1. Then I already released
1.10.1. Some issues was fixed from original repos, and some improvements done. Full CHANGELOG.md.
Now major work on
1.x is ended and it will get only fixes. Now I work on version
2.0. In new version we continue to work on original package author ideas such as bring out integration with Laravel into separated package,
Attachment improvement and support of several teams. Maybe some of this will be moved into
For backward compatibility I did not change namespaces and classes names. And I will do this in
2.0. So if you already use original package you can easily switch to new one and get all fixes and improvements just by:
composer require alek13/slack
and nothing more! No code fixes needed.
A Call Some Help
As you may understand, it will be not easy to do this all by myself. So, I want to ask you for help to revive this great, poplar, handy, but abandoned package.
First it would be nice to tell to PHP community about new package. Just about the fact that it exists. Therefore, I would ask you to repost this article, tell to colleagues and friends and for example send the link to this article in thematic chat rooms or forums.
Then, if we look at the Packagist search, the package is only on page 3. And you know why the package is new, there are still few installations, few developers know about it, few stars,.. etc. So, if you use this package, if you like it, please star it on GitHub.
If you already use the original package and you are missing something or you are hampered by some bug, let us know and create an issue on GitHub.
And if you also join the development, I will be very grateful.
Join to Slack-workspace for any questions about package use and contributing.
This article was originally written and published in Russian at phpprofi.ru.
You need to be a registered user or login to post a comment
1,540,971 PHP developers registered to the PHP Classes site.
Be One of Us!
Login Immediately with your account on:
No comments were submitted yet.