定制 hnhdigital-os/php-slack-api 二次开发

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

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

hnhdigital-os/php-slack-api

Composer 安装命令:

composer require hnhdigital-os/php-slack-api

包简介

Access your Slack Team's API through PHP objects

README 文档

README

   _____ _            _
  / ____| |          | |
 | (___ | | __ _  ___| | __
  \___ \| |/ _` |/ __| |/ /
  ____) | | (_| | (__|   <
 |_____/|_|\__,_|\___|_|\_\

Access your Slack Team's API through PHP objects.

Latest Version Total Downloads Software License

This package has been adapted from cleentfaar/slack by H&H|Digital, an Australian botique developer. Visit us at hnh.digital.

1.0.0 release

Please note that from the 1.0.0 release this package's namespace (and folder structure) will change from CL\Slack to HnhDigital\SlackApi.

From v1.0.0 all the payloads and responses will be matched with the Slack API and missing api methods (listed below) will be completed.

Documentation

  • Getting started - Before you use this library, you need to generate a token or setup oAuth.
  • Installation - Information on installing this library through composer or as a git submodule.
  • Usage - A few simple examples on how to access the Slack API using this library
  • API methods - Detailed information on each of Slack's API methods and how to access them using this library's Payload classes.
  • Events - Examples for listening to events fired by the ApiClient

Features

  • Access all of Slack's API methods with dedicated payload classes (see usage documentation)
  • Payloads and responses follow the same definitions as described in the official documentation (with a few exceptions where I think it would make a better distinction).
  • Data between you and Slack is serialized using the JMS Serializer package, allowing fully spec-ed PHP objects to be used for working with the API.
  • Code has been highly abstracted to support re-use in more specific implementations (see SlackBundle)

Unit testing

Currently unit testing is broken (as per imported repo cleentfaar/slack). This will be updated to the latest version shortly.

Feel free to fix with a PR.

Up-to-date methods

The following methods have been reviewed and updated:

  • chat.postMessage (Last reviewed: June 23, 2017)
  • chat.update (Last reviewed: June 23, 2017)
  • oauth.access (Last reviewed: June 21, 2017)
  • users.identity (Added: June 25, 2017)

Feel free to review a method and update the README with a PR.

Missing API methods

The following methods have not been implemented.

Feel free to add a PR.

  • auth.revoke
  • channels.replies
  • chat.meMessage
  • chat.unfurl
  • dnd.endDnd
  • dnd.endSnooze
  • dnd.setSnooze
  • dnd.teamInfo
  • files.comments.add
  • files.comments.delete
  • files.comments.edit
  • files.delete
  • files.revokePublicURL
  • files.sharedPulbicURL
  • im.replies
  • mpim.close
  • mpim.history
  • mpim.list
  • mpim.mark
  • mpim.open
  • mpim.replies
  • pins.add
  • pins.list
  • pins.remove
  • reactions.add
  • reactions.list
  • reactions.remove
  • reminders.add
  • reminders.complete
  • reminders.delete
  • reminders.info
  • reminders.list
  • rtm.connect
  • stars.add
  • stars.remove
  • team.accessLogs
  • team.billableInfo
  • team.integrationLog
  • team.profile.get
  • usergroups.create
  • usergroups.disable
  • usergroups.enable
  • usergroups.list
  • usergroups.update
  • usergroups.users.list
  • usergroups.users.update
  • users.deletePhoto
  • users.setPhoto
  • users.profile.get
  • users.profile.set

Methods that need removing

The following methods no longer exist in the API:

  • users.adminInvite

Related packages

FAQ

Why am I getting a cURL 60 error when attempting to connect to the Slack API?

Under the hood this library uses Guzzle to connect to the Slack API, and Guzzle's default method for sending HTTP requests is cURL.

The full error code is CURLE_SSL_CACERT: Peer certificate cannot be authenticated with known CA certificates and may be due, especially on Windows or OS X, to Guzzle not being able to find an up to date CA certificate bundle on the operating system.

To fix this you first create the Guzzle client manually using an alternative CA cert bundle, or disabling peer verification (not recommended for security reasons), and pass it to the API Client.

$client = new \GuzzleHttp\Client();
$client->setDefaultOption('verify', 'C:\Program Files (x86)\Git\bin\curl-ca-bundle.crt');

// continue as normal, using the client above

$apiClient =  new ApiClient('api-token-here', $client);

If you get a different error code you can look at the list of cURL error codes, or consult the Guzzle documentation directly.

Contributing

Please see CONTRIBUTING for details.

Credits

License

The MIT License (MIT). Please see License File for more information.

hnhdigital-os/php-slack-api 适用场景与选型建议

hnhdigital-os/php-slack-api 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 31.07k 次下载、GitHub Stars 达 9, 最近一次更新时间为 2017 年 07 月 04 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「chat」 「slack」 「slack api」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 hnhdigital-os/php-slack-api 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 hnhdigital-os/php-slack-api 我们能提供哪些服务?
定制开发 / 二次开发

基于 hnhdigital-os/php-slack-api 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 31.07k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 9
  • 点击次数: 1
  • 依赖项目数: 2
  • 推荐数: 0

GitHub 信息

  • Stars: 9
  • Watchers: 1
  • Forks: 6
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-07-04