PHPackages                             fuwasegu/slack-php-block-kit-next - 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. fuwasegu/slack-php-block-kit-next

ActiveLibrary

fuwasegu/slack-php-block-kit-next
=================================

OOP interface for writing Slack Block Kit messages and modals

v2.2.0(1y ago)013.0k2MITPHPPHP ^8.2CI passing

Since Nov 16Pushed 1y agoCompare

[ Source](https://github.com/fuwasegu/slack-php-block-kit-next)[ Packagist](https://packagist.org/packages/fuwasegu/slack-php-block-kit-next)[ RSS](/packages/fuwasegu-slack-php-block-kit-next/feed)WikiDiscussions main Synced 1mo ago

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

Slack PHP BlockKit NEXT
=======================

[](#slack-php-blockkit-next)

👉 *For formatting messages and modals for Slack using their Block Kit syntax via an OOP interface* 👈

Originally by Jeremy Lindblom ([@jeremeamia](https://twitter.com/jeremeamia))

Forked and maintained by Fuwasegu ([@fuwasegu](https://twitter.com/fuwasegu))

---

Warning!
--------

[](#warning)

This project is a fork of [this](https://github.com/slack-php/slack-php-block-kit), but deviates from the original project.

Introduction
------------

[](#introduction)

From Slack's [Block Kit documentation](https://api.slack.com/block-kit):

> **Block Kit** is a UI framework for Slack apps that offers a balance of control and flexibility when building experiences in messages and other *surfaces*.
>
> Customize the order and appearance of information and guide users through your app's capabilities by composing, updating, sequencing, and stacking *blocks* — reusable components that work almost everywhere in Slack.

This library provides an OOP interface in PHP for composing messages/modals using Slack Block Kit. It also does the reverse, meaning you can "hydrate" message/modal JSON into an object hierarchy.

Block Kit Concepts
------------------

[](#block-kit-concepts)

This library helps you build Slack messages programmatically and dynamically in your code, but you need to know how they work generally first. The library does try to prevent you from doing things you are not permitted to do in Block Kit, but it does not validate or guard against every single rule.

You may want to review the following concepts in the Slack documentation:

- [Surfaces](https://api.slack.com/surfaces) – There are 3 main types: Message, Modal, and App Home
- [Blocks](https://api.slack.com/reference/block-kit/blocks) – Includes *section*, *context*, *actions*, and more
- [Interactive Components](https://api.slack.com/reference/block-kit/interactive-components) – We call these "Inputs" in this library
- [Composition Objects](https://api.slack.com/reference/block-kit/composition-objects) – We call these "Partials" ion the library

In general, we refer to all of the different things in Block Kit collectively as "elements".

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

[](#installation)

Install easily via Composer:

```
composer require fuwasegu/slack-php-block-kit-next
```

Then include the Composer-generated autoloader in your project's initialization code.

*Note: This library is built for PHP 7.3+.*

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

[](#basic-usage)

This library supports an intuitive and fluid syntax for composing Slack surfaces (e.g., messages, modals). The `Kit`class acts as a façade to the library, and let's you start new messages/modals.

```
