PHPackages                             renzojohnson/slack-api - 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. [API Development](/categories/api)
4. /
5. renzojohnson/slack-api

ActiveLibrary[API Development](/categories/api)

renzojohnson/slack-api
======================

Lightweight PHP wrapper for Slack Web API. Send messages, blocks, and files to channels. Incoming webhooks and slash command verification. Zero dependencies.

v1.0.0(5mo ago)00MITPHPPHP ^8.4

Since Feb 24Pushed 5mo agoCompare

[ Source](https://github.com/renzojohnson/slack-api)[ Packagist](https://packagist.org/packages/renzojohnson/slack-api)[ Docs](https://renzojohnson.com)[ RSS](/packages/renzojohnson-slack-api/feed)WikiDiscussions main Synced 1w ago

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

Slack API for PHP
=================

[](#slack-api-for-php)

[![Latest Version](https://camo.githubusercontent.com/d78e36e5c0b812666bf73d9ab5bb293815390cfc3ea9d21aeae47d99dd69e253/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f72656e7a6f6a6f686e736f6e2f736c61636b2d6170692e737667)](https://packagist.org/packages/renzojohnson/slack-api)[![PHP Version](https://camo.githubusercontent.com/66f3276e11e2966d336cea9ee39d6efa20c6ce3640879eb2ebfac3fbfab505ab/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f72656e7a6f6a6f686e736f6e2f736c61636b2d6170692e737667)](https://packagist.org/packages/renzojohnson/slack-api)[![License](https://camo.githubusercontent.com/7d09c50e10526ee145d265e4bf71cf5aef16d96b4925ff5b39291377a296d023/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f72656e7a6f6a6f686e736f6e2f736c61636b2d6170692e737667)](https://github.com/renzojohnson/slack-api/blob/main/LICENSE)

Lightweight PHP wrapper for [Slack Web API](https://api.slack.com/web). Zero dependencies.

Send messages, blocks, and attachments to channels. Incoming webhooks and slash command verification with HMAC-SHA256.

**Author:** [Renzo Johnson](https://renzojohnson.com)

Requirements
------------

[](#requirements)

- PHP 8.4+
- ext-curl
- ext-json

Installation
------------

[](#installation)

```
composer require renzojohnson/slack-api
```

Quick Start
-----------

[](#quick-start)

```
use RenzoJohnson\Slack\Slack;

$slack = new Slack('xoxb-your-bot-token');

// Send a text message
$slack->sendText('#general', 'Hello from PHP!');
```

Web API Methods
---------------

[](#web-api-methods)

### Send Text

[](#send-text)

```
$slack->sendText('#general', 'Hello World');

// Thread reply
$slack->sendText('#general', 'Replying...', threadTs: '1234567890.123456');
```

### Send Blocks (Block Kit)

[](#send-blocks-block-kit)

```
use RenzoJohnson\Slack\Message\Block;

$slack->sendBlocks('#alerts', [
    Block::header('Deploy Alert'),
    Block::divider(),
    Block::section('Production deploy completed for *v2.1.0*'),
    Block::image('https://example.com/chart.png', 'CPU chart'),
], text: 'Deploy Alert — fallback for notifications');
```

### Send Attachment (Legacy)

[](#send-attachment-legacy)

```
$slack->sendAttachment(
    '#ops',
    fallback: 'Server CPU at 95%',
    color: '#ff0000',
    title: 'Server Alert',
    text: 'CPU usage has exceeded threshold.',
    fields: [
        ['title' => 'Server', 'value' => 'web-01', 'short' => true],
        ['title' => 'CPU', 'value' => '95%', 'short' => true],
    ],
);
```

### Update Message

[](#update-message)

```
$response = $slack->sendText('#general', 'Loading...');
$ts = $response['ts'];

$slack->updateMessage('#general', $ts, 'Done!');
```

### Delete Message

[](#delete-message)

```
$slack->deleteMessage('#general', '1234567890.123456');
```

### Add Reaction

[](#add-reaction)

```
$slack->addReaction('#general', '1234567890.123456', 'thumbsup');
```

### List Conversations

[](#list-conversations)

```
$channels = $slack->listConversations();
```

### Auth Test

[](#auth-test)

```
$info = $slack->authTest();
echo $info['user']; // bot username
```

Incoming Webhooks
-----------------

[](#incoming-webhooks)

No bot token needed — just a webhook URL.

```
use RenzoJohnson\Slack\Webhook\IncomingWebhook;

$webhook = new IncomingWebhook('https://hooks.slack.com/services/T.../B.../xxx');

// Simple text
$webhook->send('Deploy complete!');

// Rich message
use RenzoJohnson\Slack\Message\WebhookMessage;

$webhook->send(new WebhookMessage(
    'Deploy complete!',
    username: 'DeployBot',
    iconEmoji: ':rocket:',
));
```

Slash Commands
--------------

[](#slash-commands)

### Verify and Parse

[](#verify-and-parse)

```
use RenzoJohnson\Slack\Webhook\SlashCommand;

// Verifies X-Slack-Signature via HMAC-SHA256, returns parsed params
$params = SlashCommand::verify('your-signing-secret');

echo $params['command'];    // /weather
echo $params['text'];       // 94070
echo $params['user_name'];  // john
```

### Respond

[](#respond)

```
// Ephemeral (only visible to user)
SlashCommand::respond('Processing your request...');

// Visible to entire channel
SlashCommand::respond('Weather: 72F, Sunny', inChannel: true);
```

Error Handling
--------------

[](#error-handling)

```
use RenzoJohnson\Slack\Exception\AuthenticationException;
use RenzoJohnson\Slack\Exception\RateLimitException;
use RenzoJohnson\Slack\Exception\SlackException;

try {
    $slack->sendText('#general', 'Hello');
} catch (AuthenticationException $e) {
    // Invalid bot token
} catch (RateLimitException $e) {
    $retryAfter = $e->getRetryAfter(); // seconds
} catch (SlackException $e) {
    // Other API errors (channel_not_found, etc.)
    $errorData = $e->getErrorData();
}
```

Testing
-------

[](#testing)

```
composer install
vendor/bin/phpunit
```

Links
-----

[](#links)

- [Packagist](https://packagist.org/packages/renzojohnson/slack-api)
- [GitHub](https://github.com/renzojohnson/slack-api)
- [Issues](https://github.com/renzojohnson/slack-api/issues)
- [Author](https://renzojohnson.com)

License
-------

[](#license)

MIT License. Copyright (c) 2026 [Renzo Johnson](https://renzojohnson.com).

###  Health Score

34

—

LowBetter than 74% of packages

Maintenance71

Regular maintenance activity

Popularity0

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity52

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

174d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/6e1b69733e3d1fd486158d322c23d99281623046b3c357529c9930e50d73fcda?d=identicon)[renzo.johnson](/maintainers/renzo.johnson)

---

Top Contributors

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

---

Tags

messagingphpslackslack-apislack-botslack-webhookwebhookphpnotificationsslackmessagingwebhookchatslack-apislack-botslack-webhook

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/renzojohnson-slack-api/health.svg)

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

###  Alternatives

[scriptdevelop/whatsapp-manager

Paquete para manejo de WhatsApp Business API en Laravel

793.9k](/packages/scriptdevelop-whatsapp-manager)

PHPackages © 2026

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