定制 tiagomichaelsousa/slack-client 二次开发

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

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

tiagomichaelsousa/slack-client

最新稳定版本:v0.3.0

Composer 安装命令:

composer require tiagomichaelsousa/slack-client

包简介

A slack sdk for php

README 文档

README

Slack Client

GitHub Workflow Status (main) Total Downloads Latest Version License

Slack Client is a non-official PHP API client that allows you to interact with the Slack API ⚡️

This package is still under development. There may have methods that are still not implemented.

Get Started

The official documentation for the Slack Client will be available soon. 👀

Until there you can still explore the SDK development experience with the users(), conversations() and reminders() methods 🚀

Requires PHP 8.1+

First, install Slack Client via the Composer package manager:

composer require tiagomichaelsousa/slack-client

After that, you can interact with Slacks's API:

$client = Slack::client($token);

$conversations = $client->conversations()->create('foo');

echo $conversations->channel->name;

If necessary, it is possible to configure and create a separate client.

$client = Slack::factory()
    ->withApiKey($token)
    ->withBaseUri('slack.com/api/v2') // default: slack.com/api
    ->withHttpClient($client = new \GuzzleHttp\Client([])) // default: HTTP client found using PSR-18 HTTP Client 
    ->withHttpHeader('X-My-Header', 'foo')
    ->withQueryParam('foo', 'bar')
    ->withStreamHandler(fn (RequestInterface $request): ResponseInterface => $client->send($request, [
        'stream' => true // Allows to provide a custom stream handler for the http client.
    ]))
    ->make();

Testing

This client provides a way to easily fake the API responses through Slack\Client class.

Before using this feature please ensure that you swap the Slack\Client with Slack\Testing\ClientFake in your test case.

Besides this useful test class, you can also easily generate response objects and provide relevant information based on your use case. All responses have a fake() method to easily overwrite the objects.

use Slack\Testing\ClientFake;
use Slack\Responses\Conversation\CreateConversationResponse;

$client = new ClientFake([
    CreateConversationResponse::fake([
        'channel' => [
            'name' => 'foo',
        ],
    ]);
]);

$conversations = $client->conversations()->create('foo');

expect($conversations->channel)->name->toBe('foo');

The official documentation for the Slack Client will be available soon. 👀

Slack Client is an open-sourced software licensed under the MIT license.

统计信息

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

GitHub 信息

  • Stars: 5
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-06-30

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固