arcturial/clickatell
Composer 安装命令:
composer require arcturial/clickatell
包简介
Standalone PHP library to integrate with the Clickatell SMS gateway
README 文档
README
This library allows integration with the new Clickatell website.
Please Note: Customers with accounts registered on the old central.clickatell.com should use the tagged released or dev branches for version 2 of the repository, version 3 and up is for the new platform and older accounts will not work with this.
Usage
The new APIs only support sendMessage call and webhooks for outgoing and inbound messages via a RESTful interface.
use Clickatell\Rest; use Clickatell\ClickatellException; $clickatell = new \Clickatell\Rest('token'); // Full list of support parameters can be found at https://www.clickatell.com/developers/api-documentation/rest-api-request-parameters/ try { $result = $clickatell->sendMessage(['to' => ['27111111111'], 'content' => 'Message Content']); foreach ($result['messages'] as $message) { var_dump($message); /* [ 'apiMsgId' => null|string, 'accepted' => boolean, 'to' => string, 'error' => null|string ] */ } } catch (ClickatellException $e) { // Any API call error will be thrown and should be handled appropriately. // The API does not return error codes, so it's best to rely on error descriptions. var_dump($e->getMessage()); }
Status/Reply Callback
After configuring your webhooks/callbacks inside the developer portal, you can use the static callback methods to listen for web requests from Clickatell. These callbacks will extract the supported fields from the request body.
use Clickatell\Rest; use Clickatell\ClickatellException; // Outgoing traffic callbacks (MT callbacks) Rest::parseStatusCallback(function ($result) { var_dump($result); // This will execute if the request to the web page contains all the values // specified by Clickatell. Requests that omit these values will be ignored. }); // Incoming traffic callbacks (MO/Two Way callbacks) Rest::parseReplyCallback(function ($result) { var_dump($result); // This will execute if the request to the web page contains all the values // specified by Clickatell. Requests that omit these values will be ignored. });
arcturial/clickatell 适用场景与选型建议
arcturial/clickatell 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 752.85k 次下载、GitHub Stars 达 50, 最近一次更新时间为 2013 年 06 月 16 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 arcturial/clickatell 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 arcturial/clickatell 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 752.85k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 52
- 点击次数: 18
- 依赖项目数: 14
- 推荐数: 0
其他信息
- 授权协议: GNU
- 更新时间: 2013-06-16