PHPackages                             sanderheijselaar/slacknotifier - 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. sanderheijselaar/slacknotifier

ActiveLibrary

sanderheijselaar/slacknotifier
==============================

A package for easy implementing slack notifications in your own project

0.2.0(9y ago)053MITPHP

Since Jan 22Pushed 9y ago1 watchersCompare

[ Source](https://github.com/sanderheijselaar/SlackNotifier)[ Packagist](https://packagist.org/packages/sanderheijselaar/slacknotifier)[ RSS](/packages/sanderheijselaar-slacknotifier/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (1)Versions (3)Used By (0)

\#Slack Notifier A package for easy implementing slack notifications in your own project

\##Installation Install the composer package () or download and include the ezDebug.php file in your project

\##Quick Usage

```
use SanderHeijselaar\SlackNotifier\SlackNotifier;

```

\##Emoji If you also want to use the available emoji from class constants

```
use SanderHeijselaar\SlackNotifier\Emoji;

```

\##Config When adding a web hook, you'll get an url like:

Split this url in two and add it to a config array like below.

The 'exceptions' parameter is to tell Guzzle to throw exceptions or not. If set to true, you'll have to catch them yourself. When set to false, the errors are returned by the sendNotification method.

```
$config = array(
	"base_url"   => "https://hooks.slack.com",
	"uri"        => "/services/T44G09RET/B03YRHFIP/LpySUOJuC8GxA2kg419qfSpl",
	"exceptions" => false
);

```

\##First example A simple example to send a basic notification

```
// Set the message of the notification
$message = "My notification";
// Set the name of the sender. When left empty, the name you entered on the setup of the integration will be used.
$name    = "Bot";
// Set the recieving channel. When left empty, the name you entered on the setup of the integration will be used.
$channel = '';
// Optional emoji. You can use the SanderHeijselaar\SlackNotifier\Emoji class for this
$emoji = Emoji::WHITE_CHECK_MARK;

// Init the class
$i = new SlackNotifier($config);
// Send the notification
$result = $i->sendNotification($message, $name, $channel, $emoji, true);

// Dump the result. This is the returned result of Class \GuzzleHttp\Client method post()
echo '' . print_r(json_decode($result, true), true) . '';

```

Result:

[![Alt text](raw/img/example-01.png?raw=true "First example")](raw/img/example-01.png?raw=true)

\##Attachments ###Basics Now let's add a basic attachment

```
// Set the message of the notification
$message = "My notification";
// Set the name of the sender. When left empty, the name you entered on the setup of the integration will be used.
$name    = "Bot";
// Set the recieving channel. When left empty, the name you entered on the setup of the integration will be used.
$channel = '';
// Optional emoji. You can use the SanderHeijselaar\SlackNotifier\Emoji class for this
$emoji = Emoji::WHITE_CHECK_MARK;

// Init the class
$i = new SlackNotifier($config);

// Add a new attachment. You can add multiple attachments by repeating these steps
$i->newAttachment()
// Add a fallback text
->addAttachmentFallback('Put your fallback text here without mark up')
// Set the color of the attachment. There are three basic colors: good, warning & danger. You can also add hex colors like #ff00ff
->addAttachmentColor(SlackNotifier::COLOR_GOOD)
// Add the attachment text here. The secont parameter is to enable the mark up on this text so that the text between the * is displayed bold.
->addAttachmentText('Text *here*', true);

// Send the notification
$result = $i->sendNotification($message, $name, $channel, $emoji, true);

// Dump the result. This is the returned result of Class \GuzzleHttp\Client method post()
echo '' . print_r(json_decode($result, true), true) . '';

```

Result:

[![Alt text](raw/img/example-02.png?raw=true "Second example")](raw/img/example-02.png?raw=true)

\###Pretext By adding a pretext to the attachment, a line of text above the attachment is displayed. Italic styling is added by putting text between \_

```
->addAttachmentPreText("_Pre Text_", true)

```

Result:

[![Alt text](raw/img/example-03.png?raw=true "Third example")](raw/img/example-03.png?raw=true)

\###Author By adding an author to the attachment, a line of text will be displayed in the attachment. Here my name is displayed. It's also linked to the provided url. The fird parameter is a link to a 16x16 size icon which will be displayed on the left side before the name.

```
->addAttachmentAuthor('Sander', 'http://www.google.com', 'https://jenkins-assembler.googlecode.com/files/griffon-icon-16x16.png')

```

Result:

[![Alt text](raw/img/example-04.png?raw=true "Fourth example")](raw/img/example-04.png?raw=true)

\###Title By adding a title to the attachment, a line of text will be displayed in the attachment between the author and the text. It's also linked to the provided url.

```
->addAttachmentTitle('Title', 'http://www.title.com')

```

Result:

[![Alt text](raw/img/example-05.png?raw=true "Fifth example")](raw/img/example-05.png?raw=true)

\###Image By adding an image to the attachment, a thumb image (second argument) will be displayed and linked to the image (first argument).

```
->addAttachmentImage('http://a4.mzstatic.com/eu/r30/Purple49/v4/1a/6c/7a/1a6c7a08-db87-52ba-1d5b-eb39897c0f94/icon256.png', 'http://a4.mzstatic.com/eu/r30/Purple49/v4/1a/6c/7a/1a6c7a08-db87-52ba-1d5b-eb39897c0f94/icon256.png')

```

Result:

[![Alt text](raw/img/example-06.png?raw=true "Sixth example")](raw/img/example-06.png?raw=true)

\###Fields It's possible to add field to dislay additional short data.

```
->addAttachmentImage('http://a4.mzstatic.com/eu/r30/Purple49/v4/1a/6c/7a/1a6c7a08-db87-52ba-1d5b-eb39897c0f94/icon256.png', 'http://a4.mzstatic.com/eu/r30/Purple49/v4/1a/6c/7a/1a6c7a08-db87-52ba-1d5b-eb39897c0f94/icon256.png')

```

Result:

[![Alt text](raw/img/example-07.png?raw=true "Seventh example")](raw/img/example-07.png?raw=true)

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity54

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

Every ~333 days

Total

2

Last Release

3427d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/2448c74415930663c076b78b5e81eec428c3d0abb6aa04724fe2cb84663f1cda?d=identicon)[sheijselaar](/maintainers/sheijselaar)

---

Top Contributors

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

---

Tags

phpnotificationsslack

### Embed Badge

![Health badge](/badges/sanderheijselaar-slacknotifier/health.svg)

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

###  Alternatives

[laravel/slack-notification-channel

Slack Notification Channel for laravel.

89069.7M111](/packages/laravel-slack-notification-channel)[scriptdevelop/whatsapp-manager

Paquete para manejo de WhatsApp Business API en Laravel

762.6k](/packages/scriptdevelop-whatsapp-manager)[craftpulse/craft-notifications

Send notifications across a variety of delivery channels, including mail and Slack. Notifications may also be stored in a database so they may be displayed in your web interface.

551.2k](/packages/craftpulse-craft-notifications)[usamamuneerchaudhary/filament-notifier

A powerful notification system for FilamentPHP that handles multi-channel notifications with template management, scheduling, and real-time delivery. Built for developers who need enterprise-grade notifications without the complexity.

321.1k](/packages/usamamuneerchaudhary-filament-notifier)

PHPackages © 2026

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