yatskanich/sendpulse-rest-api-php84
最新稳定版本:v0.0.5
Composer 安装命令:
composer require yatskanich/sendpulse-rest-api-php84
包简介
Sendpulse REST API client library for PHP 8.4 support
关键字:
README 文档
README
A simple SendPulse REST client library and example for PHP.
API Documentation https://sendpulse.com/api
Requirements
- php: >=7.1.0
- ext-json: *
- ext-curl: *
Installation
Via Composer:
composer require sendpulse/rest-api
Example
<?php require 'vendor/autoload.php'; use Sendpulse\RestApi\ApiClient; use Sendpulse\RestApi\Storage\FileStorage; use Sendpulse\RestApi\ApiClientException; // API credentials from https://login.sendpulse.com/settings/#api define('API_USER_ID', ''); define('API_SECRET', ''); define('PATH_TO_ATTACH_FILE', __FILE__); $apiClient = new ApiClient(API_USER_ID, API_SECRET, new FileStorage()); /* * Send GET request * * Example: Get a List of Mailing Lists */ try { $addressBooks = $apiClient->get('addressbooks', [ 'limit' => 100, 'offset' => 0 ]); var_dump($addressBooks); } catch (ApiClientException $e) { var_dump([ 'message' => $e->getMessage(), 'http_code' => $e->getCode(), 'response' => $e->response, 'curl_errors' => $e->getCurlErrors(), 'headers' => $e->getHeaders() ]); } /* * Send POST request * * Example: Add new email to mailing lists */ try { $addEmailsResult = $apiClient->post('addressbooks/33333/emails', [ 'emails' => [ [ 'email' => 'test_email@test.com', 'variables' => [ 'phone' => '+123456789', 'my_var' => 'my_var_value' ] ], [ 'email' => 'email_test@test.com', 'variables' => [ 'phone' => '+987654321', 'my_var' => 'my_var_value' ] ] ] ]); var_dump($addEmailsResult); } catch (ApiClientException $e) { var_dump([ 'message' => $e->getMessage(), 'http_code' => $e->getCode(), 'response' => $e->response, 'curl_errors' => $e->getCurlErrors(), 'headers' => $e->getHeaders() ]); } /* * Send PUT request * * Example: Edit a Mailing List */ try { $addEmailsResult = $apiClient->put('addressbooks/33333', [ 'name' => "New Name" ]); var_dump($addEmailsResult); } catch (ApiClientException $e) { var_dump([ 'message' => $e->getMessage(), 'http_code' => $e->getCode(), 'response' => $e->response, 'curl_errors' => $e->getCurlErrors(), 'headers' => $e->getHeaders() ]); } /* * Send PATCH request * * Example: Edit Scheduled Campaign */ try { $editScheduledCampaignResult = $apiClient->patch('campaigns/333333', [ "name" => "My_API_campaign", "sender_name" => "sender", "sender_email" => "sender@test.com", "subject" => "Hello customer", "template_id" => 351594, "send_date" => "2023-10-21 11:45:00" ]); var_dump($editScheduledCampaignResult); } catch (\Sendpulse\RestApi\ApiClientException $e) { var_dump([ 'message' => $e->getMessage(), 'http_code' => $e->getCode(), 'response' => $e->response, 'curl_errors' => $e->getCurlErrors(), 'headers' => $e->getHeaders() ]); } /* * Send DELETE request * * Example: Delete Emails from a Mailing List */ try { $removeEmailsResult = $apiClient->delete('addressbooks/33333/emails', [ 'emails' => ['test@test.com'] ]); var_dump($removeEmailsResult); } catch (ApiClientException $e) { var_dump([ 'message' => $e->getMessage(), 'http_code' => $e->getCode(), 'response' => $e->response, 'curl_errors' => $e->getCurlErrors(), 'headers' => $e->getHeaders() ]); } /* * Example: Start Automation360 event */ try { $startEventResult = $apiClient->post('events/name/my_event_name', [ "email" => "test@test.com", "phone" => "+123456789", "products" => [ [ "id" => "id value", "name" => "name value" ] ] ]); var_dump($startEventResult); } catch (ApiClientException $e) { var_dump([ 'message' => $e->getMessage(), 'http_code' => $e->getCode(), 'response' => $e->response, 'curl_errors' => $e->getCurlErrors(), 'headers' => $e->getHeaders() ]); } /** * Example: Crm create a new deal */ try { $crmCreateDeal = $apiClient->post('crm/v1/deals', [ "pipelineId" => 0, "stepId" => 0, "responsibleId" => 0, "name" => "string", "price" => 0, "currency" => "string", "sourceId" => 0, "contact" => [ 0 ], "attributes" => [ [ "attributeId" => 0, "value" => "string" ] ], "attachments" => [ "https://link-to-file.com/file.jpg" ] ]); var_dump($crmCreateDeal); } catch (ApiClientException $e) { var_dump([ 'message' => $e->getMessage(), 'http_code' => $e->getCode(), 'response' => $e->response, 'curl_errors' => $e->getCurlErrors(), 'headers' => $e->getHeaders() ]); } /** * Example: Whatsapp send a template message to the specified contact */ try { $sendTemplateByPhoneResult = $apiClient->post('whatsapp/contacts/sendTemplateByPhone', [ "bot_id" => "xxxxxxxxxxxxxxxxxxxxxxxx", "phone" => "380931112233", "template" => [ "name" => "thanks_for_buying", "language" => [ "code" => "en" ], "components" => [] ] ]); var_dump($sendTemplateByPhoneResult); } catch (ApiClientException $e) { var_dump([ 'message' => $e->getMessage(), 'http_code' => $e->getCode(), 'response' => $e->response, 'curl_errors' => $e->getCurlErrors(), 'headers' => $e->getHeaders() ]); }
yatskanich/sendpulse-rest-api-php84 适用场景与选型建议
yatskanich/sendpulse-rest-api-php84 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 38 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 06 月 12 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「rest」 「api」 「sendpulse」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 yatskanich/sendpulse-rest-api-php84 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 yatskanich/sendpulse-rest-api-php84 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 yatskanich/sendpulse-rest-api-php84 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Client for service sendpulse
Laravel package for email service
A PSR-7 compatible library for making CRUD API endpoints
Api bundle
Laravel Package for Sendpulse API. Provides easy access to the sendpulse/sendpulse-rest-api-php library.
Sendpulse REST API client library
统计信息
- 总下载量: 38
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 17
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-06-12