PHPackages                             kktsvetkov/slaho - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. kktsvetkov/slaho

AbandonedArchivedLibrary[Utility &amp; Helpers](/categories/utility)

kktsvetkov/slaho
================

Posts messages to Slack webhooks

v1.0(9y ago)1341LGPL-3.0PHPPHP &gt;=5.3.0

Since Feb 7Pushed 8y ago1 watchersCompare

[ Source](https://github.com/kktsvetkov/slaho)[ Packagist](https://packagist.org/packages/kktsvetkov/slaho)[ Docs](https://github.com/kktsvetkov/slaho/)[ RSS](/packages/kktsvetkov-slaho/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (1)DependenciesVersions (2)Used By (0)

Slaho
=====

[](#slaho)

Slaho (short for **SLA**ck Web**HO**ok), is a small PHP5 library for posting messages to Slack, using their webhooks.

It is meant to be very easy to use. I've had experience with several other Slack implementations and they were quite clumsy and overdressed for my tast. This is meant to be used only for posting messages using Slack webhooks.

Basic use
---------

[](#basic-use)

You create a new object by providing the Slack webhook to use.

```
$s = new slaho('https://hooks.slack.com/services/T2Y...lEavL9k');

```

Additional argument to the constructor is an array with formatting details that can be re-used as defaults for all messages being posted with this Slaho object. Those are the "username", "icon\_url" anf "icon\_emoji" settings:

```
$s = new slaho('https://hooks.slack.com/servi...vR8z', [
	"username" => "Slaho",
	"icon_emoji" => ":cat:"
]);

```

Once you have an object created, you can start posting messages with it like this:

```
$s->message('Hello World');

```

These messages can have additional formatting provided by the second argument of `slaho::message()` method:

```
$s->message('Hello World!', ['attachments' => [
	['text' => 'Attachment message']
]]);

```

You can read more about Slack message and their formatting, links, attachments, etc in their docs.

If you have the whole JSON data that you need to post to Slack, you can do it by calling the `slack::post()` method directly like this:

```
$s->post(json_encode(['username' => 'Me!', 'text' => 'G\'day, Boy-o!']));

```

Callbacks for posting
---------------------

[](#callbacks-for-posting)

The messages are send with HTTP POST requests towards the Slack webhooks. This is a very basic and common thing nowadays, but still it might offer some challenges denepding on the environment in whcih it is deployed.

In Slaho there are two built-in methods that are used to send the POST requests: one used the `curl` PHP extension (if it is installed), and the other used the `curl` binary (which it attempts to find on your system). This is all done under the hood and you do not have to do anything.

However, you might want to use a different mechanism to do the POST request. In Slaho there is a way to set your own callback to do that. Here's an example where I put a new callback which I am going to use for debugging - instead of posting the message, it will print it out:

```
slaho::callback(function($json, $webhook) {
	var_dump([$json, $webhook]);
});

```

The callbacks must take two arguments: first is the JSON encoded message that must be posted, and the second is the webhook URL to post to.

Message formatting
------------------

[](#message-formatting)

Second argument of `slaho::message()` is for the extra formatting you can apply to the message. You can read more about this in Slack documentation. To make it easier to create and work with that formatting, there's a static array with two elements which are provided as examples:

- first one is of a basic message formatting (just with "username" and "icon\_url"/"icon\_emoji"),
- and the second one is with "attachments"

You can read them and use to create some messages with rich formatting:

```
$s->message('Hello World!', slaho::$example[1]);

```

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

3379d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/b59326c3407a4f69763aade9634385da9788faab0307329c0dd277021dbe0340?d=identicon)[kktsvetkov](/maintainers/kktsvetkov)

---

Top Contributors

[![kktsvetkov](https://avatars.githubusercontent.com/u/694812?v=4)](https://github.com/kktsvetkov "kktsvetkov (4 commits)")

---

Tags

slackwebhookweb-hookslaho

### Embed Badge

![Health badge](/badges/kktsvetkov-slaho/health.svg)

```
[![Health](https://phpackages.com/badges/kktsvetkov-slaho/health.svg)](https://phpackages.com/packages/kktsvetkov-slaho)
```

###  Alternatives

[maknz/slack-laravel

Laravel 4 and 5 integration for the maknz/slack package, including facades and service providers.

154969.3k1](/packages/maknz-slack-laravel)[jeremykenedy/slack-laravel

Laravel integration for the jeremykenedy/slack package, including facades and service providers.

54738.8k](/packages/jeremykenedy-slack-laravel)[razorpay/slack-laravel

Laravel 4 and 5 integration for the razorpay/slack package, including facades and service providers.

18375.3k1](/packages/razorpay-slack-laravel)[dintel/php-github-webhook

Simple class for handling GitHub webhook calls

5115.5k](/packages/dintel-php-github-webhook)[ankurk91/laravel-ses-webhooks

Handle AWS SES webhooks in Laravel php framework

2534.2k](/packages/ankurk91-laravel-ses-webhooks)[atakde/discord-webhook-php

discord webhook php

186.5k](/packages/atakde-discord-webhook-php)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
