PHPackages                             ntimyeboah/php-slack - 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. ntimyeboah/php-slack

ActiveLibrary[API Development](/categories/api)

ntimyeboah/php-slack
====================

A package to integrate Slack in your PHP applications

v1.0.0(1y ago)08MITPHPPHP ^8.2

Since Jan 30Pushed 1y ago1 watchersCompare

[ Source](https://github.com/NtimYeboah/php-slack)[ Packagist](https://packagist.org/packages/ntimyeboah/php-slack)[ RSS](/packages/ntimyeboah-php-slack/feed)WikiDiscussions main Synced today

READMEChangelog (4)Dependencies (2)Versions (6)Used By (0)

Integrate Slack into your PHP applications
==========================================

[](#integrate-slack-into-your-php-applications)

[![Build Status](https://github.com/NtimYeboah/php-slack/actions/workflows/test.yml/badge.svg)](https://github.com/NtimYeboah/php-slack/actions/workflows/test.yml/badge.svg)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)

This package makes it easier to integrate Slack into your PHP application. It provides intuitive and simple API to send simple messages and complex messages using the BlockKit framework.

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

[](#requirements)

This package requires at least [PHP](https://php.net) 8.2.

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

[](#installation)

```
composer require ntimyeboah/php-slack
```

Basic Usage
-----------

[](#basic-usage)

### Sending messages

[](#sending-messages)

You have the option to send messages by configuring the Slack token and channel methods on the SlackMessage object using the `token()` and `channel()` methods respectively.

```
use NtimYeboah\PhpSlack\SlackMessage;

(new SlackMessage)
    ->token('xoxb-123abc')
    ->channel('general')
    ->text('Hello')
    ->send();
```

You can also configure the Slack token and channel using the Credentials object.

```
use NtimYeboah\PhpSlack\Credentials

$credentials = Credentials::make('general', 'xoxb-123abc');

$slackMessage = new SlackMessage($credentials);

$slackMessage->text('Hello')
$slackMessage->send();
```

Advanced Usage
--------------

[](#advanced-usage)

This package make it easy to send messages using the BlockKit framework to customize and order the appearance of your messages.

### Sending messages using the Section block

[](#sending-messages-using-the-section-block)

Use the `section($closure)` method to send a Section block.

```
use NtimYeboah\PhpSlack\Credentials;
use NtimYeboah\PhpSlack\BlockKit\Blocks\Section;

$credentials = Credentials::make('general', 'xoxb-123abc');

(new SlackMessage($credentials))
    ->section(function (Section $section) {
        $section->field('This is a field')->markdown();
        $section->field('This is another field');
    })
    ->send();
```

The above generates these blocks.

```
[
    {
        "type": "section",
        "fields": [
            {
                "type": "mrkdwn",
                "text": "This is a field"
            },
            {
                "type": "plain_text",
                "text": "This is another field"
            }
        ]
    }
]

```

### Sending messages using the Context block

[](#sending-messages-using-the-context-block)

Use the `context($closure)` method to send a Context block.

```
use NtimYeboah\PhpSlack\Credentials;
use NtimYeboah\PhpSlack\BlockKit\Blocks\Context;

$credentials = Credentials::make('general', 'xoxb-123abc');

(new SlackMessage($credentials))
    ->context(function (Context $block) {
        $block->text("*This* is :smile markdown")->markdown();
        $block->image('http://path/to/image.jpg')->altText('cute cat');
        $block->text('This is a plain text');
    })
    ->send()
```

The above generates these blocks.

```
[
    {
        "type": "context",
        "elements": [
            {
                "type": "mrkdwn",
                "text": "*This* is :smile markdown"
            },
            {
                "type": "image",
                "image_url": "http:\/\/path\/to\/image.jpg",
                "alt_text": "cute cat"
            },
            {
                "type": "plain_text",
                "text": "This is a plain text"
            }
        ]
    }
]

```

### Sending messages using the Header block

[](#sending-messages-using-the-header-block)

Use the `header($closure)` method to send a Header block.

```
use NtimYeboah\PhpSlack\Credentials;
use NtimYeboah\PhpSlack\BlockKit\Blocks\Header;

$credentials = Credentials::make('general', 'xoxb-123abc');

(new SlackMessage($credentials))
    ->header(function (Header $block) {
        $block->text('This is a header text');
    })
    ->send();
```

The code above generates these blocks.

```
[
    {
        "type": "header",
        "text": {
            "type": "plain_text",
            "text": "This is a header text"
        }
    }
]

```

### Sending messages using the RichText block

[](#sending-messages-using-the-richtext-block)

Use the `richText($closure)` method to send a Rich Text block.

```
use NtimYeboah\PhpSlack\Credentials;
use NtimYeboah\PhpSlack\BlockKit\Blocks\RichText;

$credentials = Credentials::make('general', 'xoxb-123abc');

(new SlackMessage($credentials))
    ->richText(function (RichText $block) {
        $block->text('This is a text');
        $block->text('This is a bold text')->bold();
        $block->text('This is an italic text')->italic();
        $block->text('This is a strikethrough text')->strike();
        $block->emoji('basketball');
    })
    ->send();
```

The above generates these blocks.

```
[
    {
        "type": "rich_text",
        "elements": [
            {
                "type": "rich_text_section",
                "elements": [
                    {
                        "type": "text",
                        "text": "This is a text"
                    },
                    {
                        "type": "text",
                        "text": "This is a bold text",
                        "style": {
                            "bold": true
                        }
                    },
                    {
                        "type": "text",
                            "text": "This is an italic text",
                            "style": {
                                "italic": true
                        }
                    },
                    {
                        "type": "text",
                        "text": "This is a strikethrough text",
                        "style": {
                            "strike": true
                        }
                    },
                    {
                        "type": "emoji",
                        "name": "basketball"
                    }
                ]
            }
        ]
    }
]

```

### Sending messages using the Divider block

[](#sending-messages-using-the-divider-block)

Use the `divider()` method to send a Divider block.

```
use NtimYeboah\PhpSlack\Credentials;

$credentials = Credentials::make('general', 'xoxb-123abc');

(new SlackMessage($credentials))
    ->divider()
    ->send();
```

The above generates this block.

```
[
    {
        type": "divider"
    }
]

```

Consider hiring me
------------------

[](#consider-hiring-me)

I am currently seeking new employment opportunities and would appreciate it if you'd keep me in mind for roles such as Backend Developer. Kindly contact me at:

This is a link to my CV: [Ntim Yeboah CV](https://docs.google.com/document/d/1jXVsN1NU5AH2XhStxjuwumGIqunoyk0cPPXZr6viaNs/edit?usp=sharing)

Changelog
---------

[](#changelog)

Please see [CHANGELOG](https://github.com/NtimYeboah/php-slack/blob/master/CHANGELOG.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](https://github.com/NtimYeboah/php-slack/blob/master/CONTRIBUTING.md) for details.

Security
--------

[](#security)

If you discover a security vulnerability within this package, please send an e-mail to Ntim Yeboah at . All security vulnerabilities will be promptly addressed.

License
-------

[](#license)

Php Slack is licensed under [The MIT License (MIT)](LICENSE).

###  Health Score

29

—

LowBetter than 57% of packages

Maintenance40

Moderate activity, may be stable

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity55

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

Total

5

Last Release

511d ago

Major Versions

v0.0.7 → v1.x-dev2025-02-08

### Community

Maintainers

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

---

Top Contributors

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

---

Tags

integrationpackagephpslackphpslackintegration

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/ntimyeboah-php-slack/health.svg)

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

###  Alternatives

[tencentcloud/tencentcloud-sdk-php

TencentCloudApi php sdk

3741.3M45](/packages/tencentcloud-tencentcloud-sdk-php)[resend/resend-php

Resend PHP library.

617.2M43](/packages/resend-resend-php)[checkout/checkout-sdk-php

Checkout.com SDK for PHP

563.6M13](/packages/checkout-checkout-sdk-php)[eslazarev/wildberries-sdk

Wildberries OpenAPI clients (generated).

273.0k](/packages/eslazarev-wildberries-sdk)[files.com/files-php-sdk

Files.com PHP SDK

2481.1k](/packages/filescom-files-php-sdk)[aimeos/prisma

A powerful PHP package for integrating media related Large Language Models (LLMs) into your applications

1943.1k5](/packages/aimeos-prisma)

PHPackages © 2026

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