ridibooks / crm
Ridibooks CRM PHP 库
该软件包的规范仓库似乎已消失,因此软件包已被冻结。
3.0.0
2020-09-14 01:48 UTC
Requires
- php: ^7.1||^7.2
- guzzlehttp/guzzle: ^6.0
Requires (Dev)
- php-coveralls/php-coveralls: ^2.1
- phpunit/php-code-coverage: 5.3.2
- phpunit/phpunit: ^6.5
- squizlabs/php_codesniffer: ^3.2
README
介绍
CRM API PHP SDK 提供用于 RIDI 中 CRM API 服务器的客户端。
此库使用 guzzlehttp/guzzle 作为 HTTP 客户端
安装
composer require ridibooks/crm
使用方法
使用 CRM API 服务器发送消息
use Ridibooks\Crm\Client; use Ridibooks\Crm\Notification\Identifier; use Ridibooks\Crm\Notification\ImageType; use Ridibooks\Crm\Notification\MessageType; use Ridibooks\Crm\Notification\Payload\ApnsPush; use Ridibooks\Crm\Notification\Payload\Email; use Ridibooks\Crm\Notification\Payload\GcmPush; use Ridibooks\Crm\Notification\Payload\NotificationCenterMessage; use Ridibooks\Crm\Notification\Tag; $client = new Client(); $client_with_retry_handler = Client::createWithDefaultRetry(); $identifier = new Identifier(MessageType::CMS, 'campaign-id', [Tag::CMS]); $landing_url = 'https://ridibooks.com'; $user_id = 'u_id'; $message = '십오야 최대 4만 포인트 증정!'; $icon = 'https://active.ridibooks.com/ridibooks_noti_icon/icon_noti_15ya.png'; $expire_at = ((new \DateTime())->getTimestamp() + 3600) * 1000; $notification_center_message = new NotificationCenterMessage( [$user_id], $identifier, $message, $icon, ImageType::ICON, $landing_url, $expire_at ); $client->sendNotificationCenterMessage($notification_center_message); $force_silent = true; $apns_push = new ApnsPush($user_id, $message, $landing_url, $identifier, $force_silent); $response = $client->sendApnsPush($apns_push); echo $response->getStatusCode(); $title = '최대 4만원 포인트 혜택'; $gcm_push = new GcmPush($user_id, $title, $message, $landing_url, $icon, $identifier, $force_silent); $response = $client->sendGcmPush($gcm_push); echo $response->getStatusCode(); $from = '리디북스 <no-reply@ridibooks.com>'; $to = 'to@example.com'; $subject = '최대 4만원 포인트 혜택'; $html = '<h1>%recipient.greeting%</h1><p>hello world</p>'; $cc = 'cc@example.com'; $bcc = 'bcc@exmaple.com'; $recipient_variables = [ 'to@example.com' => ['greeting' => '안녕하세요'], 'cc@example.com' => ['greeting' => 'hello'], 'bcc@example.com' => ['greeting' => 'guten tag'], ]; $email = new Email($from, [$to], $subject, $html, $identifier, $recipient_variables, [$cc], [$bcc]); $response = $client->sendEmail($email); echo $response->getStatusCode(); $response = $client->getQueueStatus(); echo $response->getQueueStatus(); echo implode(',', $response->getNameOfQueues());
CRM API SDK 发布步骤
- 创建
release/{version}
分支。 - 更新
RELEASES.md
。 - 提交所有更改并推送,然后发起拉取请求。
- 在 PR 之后,在 GitHub 上标记一个新的发布版本。这将使 Packagist 发布新版本。