定制 ramiroestrella/slack-message-blocks 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

ramiroestrella/slack-message-blocks

Composer 安装命令:

composer require ramiroestrella/slack-message-blocks

包简介

Slack Message Blocks is a PHP package designed to simplify the process of creating and sending rich, interactive messages to Slack. This package provides a fluent interface for building various Slack message elements, including buttons, select menus, date pickers, and more.

README 文档

README

Slack Message Blocks is a PHP package designed to simplify the process of creating and sending rich, interactive messages to Slack. This package provides a fluent interface for building various Slack message elements, including buttons, select menus, date pickers, and more.

Features

  • Fluent Interface: Easily chain methods to build complex Slack messages.
  • Rich Elements: Support for buttons, select menus, checkboxes, radio buttons, date pickers, time pickers, and more.
  • Customizable: Configure elements with placeholders, initial values, and additional options.
  • Webhook Integration: Send messages directly to Slack using webhooks.

Installation

Install the package via Composer:

composer require ramiroestrella/slack-message-blocks

Usage

Creating a Message

use SlackMessage\Message;
use SlackMessage\Enums\ButtonStyle;

$webhookUrl = 'https://hooks.slack.com/services/your/webhook/url';

$message = (new Message($webhookUrl))
    ->header('Daily Standup')
    ->text('Please provide your updates:')
    ->button('Submit', 'submit_value', 'submit_action', ButtonStyle::PRIMARY)
    ->send();

if ($message) {
    echo "Message sent successfully!";
} else {
    echo "Failed to send message.";
}

Adding Elements

You can add various elements to your message:

$message = (new Message($webhookUrl))
    ->header('Daily Standup')
    ->text('Please provide your updates:')
    ->datePicker('Select a date', 'date_picker_action')
    ->timePicker('Select a time', 'time_picker_action')
    ->userSelect('Select a user', 'Select a user', 'user_select_action')
    ->checkboxes('Select options', 'checkboxes_action', function($checkboxOption) {
        $checkboxOption->option('Option 1', 'value1')
                       ->option('Option 2', 'value2');
    })
    ->send();

Documentation

For detailed documentation on all available methods and options, please refer to the source code and doc comments.

License

This package is open-sourced software licensed under the MIT license.

统计信息

  • 总下载量: 965
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 2
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-01-07