Reincarnation of popular PHP package for Slack
Hi, everyone!
Today I want to tell about small but popular open source package and ask some help from you.
Slack
I think most of you use Slack in your teams for simplifying work on your project. For this, Slack is very great and helpful.
You can create several channels in it for different departments or/and different subteams — for example, for frontend, backend, devops,.. You can connect all kinds of already implemented integrations for every taste: Bitbucket, GitHub, GitLab, Jira, Trello — all that you could only think about, probably already implemented 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 write your own. And so on…
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.
PHP 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 maknz/slack
.
This package at the moment has about 2 millions installs, almost 1000 stars and 150 forks. This package has 73 depended packages, including all kinds of integrations with different frameworks (Laravel, Symfony, Yii, …) and automations like PHP-CI. Lets consent that’s fairly well.
Package supports PHP 5.4 or above, including PHP 7. It has only guzzlehttp/guzzle
in own dependencies, and herewith it can use any of versions ~6.0|~5.0|~4.0
, what is important enough for compatibility with other packages. It has auto build on Travis and good quality score on Scrutinizr. Sounds cool!
More? This package has several pre-releases (0.1.0
, 0.1.1
, 0.2.0
, 0.2.1
, 0.2.2
, 0.3.0
) and impressive track record in stable - 1.1.0
, 1.2.0
, 1.3.0
, 1.4.0
, 1.5.0
, 1.6.0
, 1.7.0
. On GitHub there are bug-reports/feature-requests and pull-requests from third-party developers (contributors), that means some community already was formed, that 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 for happiness? Ok, take, install, use. Couple of minutes to create incoming webhook
in Slack admin; copy here url to hook; paste into config; couple lines of code, and in a few minutes you get your first test message in your Slack. Perfect!
That’s 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…
Surprise
First I found out that the needed functional was not in 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 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 it is 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… 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. Have to look for alternatives. But as turned out, there are no alternatives. Write own from scratch — I do not want to.
New package 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.0
and 1.8.1
. Then I already released 1.9.0
, 1.9.1
, 1.10.0
, 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 3.0
version.
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 remove maknz/slack
composer require alek13/slack
and nothing more! No code fixes needed.
Some Help
But, as you understand, it will be not easy to do alone. 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.
Originally published at phpprofi.ru.