PHPackages                             edbox/slack-notifier - 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. [Mail &amp; Notifications](/categories/mail)
4. /
5. edbox/slack-notifier

ActiveLibrary[Mail &amp; Notifications](/categories/mail)

edbox/slack-notifier
====================

PSR-4 Slack Webhook Notifier with formatting, throttling, and context providers.

v1.1.3(7mo ago)06proprietaryPHP

Since Nov 17Pushed 7mo agoCompare

[ Source](https://github.com/gadnis/slack-notifier)[ Packagist](https://packagist.org/packages/edbox/slack-notifier)[ RSS](/packages/edbox-slack-notifier/feed)WikiDiscussions main Synced today

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

Edbox Slack Notifier
====================

[](#edbox-slack-notifier)

A clean, PSR-4 compliant Slack Webhook notification library for PHP.

This package provides:

- 🔥 Easy Slack message sending
- ⚠️ Message levels: `info`, `warning`, `error`
- 🎨 Rich formatting (emoji + Slack code blocks)
- 🌍 Context providers (domain/IP or custom)
- 🛡 Throttling with pluggable storage
- 🧩 Fully framework-agnostic (PrestaShop, Laravel, Symfony, CLI, cron)
- 📦 Zero dependencies except `psr/log`

---

🚀 Installation
--------------

[](#-installation)

Install via Composer:

```
composer require edbox/slack-notifier
```

Or if using a local package:

```
"repositories": [
  {
    "type": "path",
    "url": "slack_notifier_psr"
  }
]
```

---

🧩 Basic Usage
-------------

[](#-basic-usage)

### 1. Implement a Webhook Provider

[](#1-implement-a-webhook-provider)

```
use Edbox\Slack\WebhookProviderInterface;

class MyWebhookProvider implements WebhookProviderInterface {
    public function getWebhookUrl(): ?string {
        return 'https://hooks.slack.com/services/XXXX/YYYY/ZZZZ';
    }
}
```

### 2. Choose throttling storage

[](#2-choose-throttling-storage)

```
use Edbox\Slack\ArrayThrottleStorage;

$storage = new ArrayThrottleStorage(); // In‑memory
```

### 3. Create SlackClient

[](#3-create-slackclient)

```
use Edbox\Slack\SlackClient;
use Edbox\Slack\SlackFormatter;
use Edbox\Slack\SlackThrottle;
use Edbox\Slack\DefaultContextProvider;

$slack = new SlackClient(
    new MyWebhookProvider(),
    $logger,                          // Any PSR‑3 logger
    new SlackFormatter(),
    new SlackThrottle(3600, $storage), // 1 hour throttle
    new DefaultContextProvider()
);
```

### 4. Send messages

[](#4-send-messages)

```
use Edbox\Slack\SlackMessage;

$slack->send(SlackMessage::info("Cache refreshed"));
$slack->send(SlackMessage::warning("API limit approaching"));
$slack->send(SlackMessage::error("Token expired"));
```

### 5. Add context

[](#5-add-context)

```
$msg = SlackMessage::error("Feed parsing failed")
    ->withContext(['source' => 'instagram', 'id' => 18]);

$slack->send($msg);
```

Slack output:

```
🔥 [ERROR]
yourdomain.com (1.1.1.1) | Feed parsing failed
Context: {
    "source": "instagram",
    "id": 18
}

```

---

🌍 Custom Context Provider
-------------------------

[](#-custom-context-provider)

```
use Edbox\Slack\ContextProviderInterface;

class MyContextProvider implements ContextProviderInterface {
    public function getPrefix(): array {
        return ['billing', 'v2.1'];
    }
}
```

---

🛡 Throttling Explained
----------------------

[](#-throttling-explained)

Throttling prevents Slack spam.

A message is uniquely identified by:

- Context prefix
- Message level
- Message text

Configured via:

```
new SlackThrottle(3600, $storage); // 1 hour
```

---

📜 License
---------

[](#-license)

Private — © 2024 EDBOX. All rights reserved.

###  Health Score

30

—

LowBetter than 62% of packages

Maintenance63

Regular maintenance activity

Popularity4

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity39

Early-stage or recently created project

 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 ~0 days

Total

5

Last Release

227d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/6d6e483642eb2e33abcfa3878dd1b69ae2de83fa0bf10c2251b83911d67da213?d=identicon)[gadnis](/maintainers/gadnis)

---

Top Contributors

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

### Embed Badge

![Health badge](/badges/edbox-slack-notifier/health.svg)

```
[![Health](https://phpackages.com/badges/edbox-slack-notifier/health.svg)](https://phpackages.com/packages/edbox-slack-notifier)
```

###  Alternatives

[maize-tech/laravel-email-domain-rule

Laravel Email Domain Rule

612.0k](/packages/maize-tech-laravel-email-domain-rule)[sarfraznawaz2005/noty

Laravel package to incorporate noty flash notifications into laravel.

324.5k](/packages/sarfraznawaz2005-noty)

PHPackages © 2026

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