snappy/php-sdk
Composer 安装命令:
composer require snappy/php-sdk
包简介
PHP SDK for the BeSnappy.com
README 文档
README
Installation
The SDK should be installed via Composer. Simply add the snappy/php-sdk dependency to your composer.json file.
Usage
First, create a new authentication provider:
$auth = new SnappySdk\UserPassAuthentication('user', 'pass');
Next, create an SDK client instance:
$client = new SnappySdk\Client($auth);
Now you're ready to start retrieving information from Snappy!
$accounts = $client->getAccounts();
Sending Messages
To send a message to your Snappy account, create a new Message instance, and use the sendMessage method on the client:
$message = new SnappySdk\Message;
$message->mailboxId = 3;
$message->setFrom('foo@bar.com', 'John Smith');
$message->subject = 'Hello World';
$message->message = 'This is my message!';
$nonce = $client->sendMessage($message);
To send an outgoing message, a staffId must be specified, as well as the recipient address:
$message = new SnappySdk\Message;
$message->mailboxId = 3;
$message->staffId = 3;
$message->addTo('foo@bar.com', 'John Smith');
$message->subject = 'Hello World';
$message->message = 'This is my message!';
$nonce = $client->sendMessage($message);
If you are attaching a message to an existing thread, add the ticket "nonce" to the message:
$message->ticketId = $nonce;
Available Methods
These are the available SDK client methods. They all interact with the Snappy API.
- getAccounts
- search($query, $page = 1)
- getMailboxes($accountId)
- getDocuments($accountId)
- getStaff($accountId)
- getContact($accountId, $idOrEmailAddress)
- getWaitingTickets($mailboxId)
- getTicketDetails($ticketId)
- getTicketNotes($ticketId)
- updateTicketTags($ticketId, $tags)
- sendMessage($message)
- getWallPost($accountId, $after = 0)
- postToWall($accountId, $content, $type = 'post', $tags = array(), $ticket = null, $note = null)
- deleteWallPost($accountId, $postId)
- commentOnWallPost($accountId, $postId, $comment)
- deleteWallComment($accountId, $postId, $commentId)
- likeWallPost($accountId, $postId)
- unlikeWallPost($accountId, $postId)
- getFaqs($accountId)
- searchFaqs($accountId, $query, $page = 1)
- createFaq($accountId, $title, $url = 'faq')
- updateFaq($accountId, $faqId, $title, $url = 'faq')
- deleteFaq($accountId, $faqId)
- getFaqTopics($accountId, $faqId)
- createFaqTopic($accountId, $faqId, $topic, $order = 0)
- updateFaqTopic($accountId, $faqId, $topic, $order = 0)
- deleteFaqTopic($accountId, $faqId, $topicId)
- getTopicQuestions($accountId, $faqId, $topicId)
- createTopicQuestion($accountId, $faqId, $topicId, $question, $answer)
- updateTopicQuestion($accountId, $faqId, $topicId, $questionId, $question, $answer)
- deleteTopicQuestion($accountId, $faqId, $topicId, $questionId)
snappy/php-sdk 适用场景与选型建议
snappy/php-sdk 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 8.35k 次下载、GitHub Stars 达 9, 最近一次更新时间为 2013 年 05 月 06 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 snappy/php-sdk 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 snappy/php-sdk 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 8.35k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 9
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2013-05-06