cicerbro/sendy-php-api
Composer 安装命令:
composer require cicerbro/sendy-php-api
包简介
Sendy PHP API Wrapper: Complete API interfacing.
关键字:
README 文档
README
🚀 Sendy PHP API Wrapper: Complete API interfacing.
📨 SENDY API
Forked from the original author: ahmadawais/Sendy-PHP-API
Warning
This package is deprecated. Existing integrations should continue to work, but this repository is no longer actively maintained and will not receive future updates.
With this Sendy PHP API Wrapper you can do the following:
| SUBSCRIBERS | LISTS | CAMPAIGNS |
|---|---|---|
| Subscribe | Set List | Create |
| Unsubscribe | Get List | Draft |
| Delete subscriber | Active subscriber count | Send |
| Subscription status | List Segments handling | Assign to brands |
Getting Started
Getting started is easy. Here's how you do it. You can check the example.php file as well. Obviously, you'll have to download the wrapper to your current setup. Several ways to do that.
#1 MANUAL INSTALL:
Git clone this repo and include ./src/API.php in your project.
#2 COMPOSER INSTALL:
Composer Install is the preferred method.
composer require ahmadawais/sendy-php-api
Step 0. Require the wrapper
// New way using PSR4 Standard autoloader. Recommended require_once . '/vendor/autoload.php'; // Old way of requiring all files manually. Not recommended. require_once( 'API.php' );
Step 1. Configure it
// 2. Configuration. $config = [ 'sendyUrl' => 'https://send_installation_url.com', // Your Sendy installation URL (without trailing slash). 'apiKey' => 'XXXXXXXXXXXXXXXX', // Your API key. Available in Sendy Settings. 'listId' => 'XXXXXXXXXXXXXXXX', ];
Step 2. Init
use AhmadAwais\Sendy\API as Sendy; $sendy = new Sendy( $config );
API KEY METHODS
- Method:
subscribe(). - Method:
unsubscribe(). - Method:
subStatus(). - Method:
delete(). - Method:
subCount(). - Method:
campaign().
Method #1: Subscribe
// Method #1: Subscribe. $responseArray = $sendy->subscribe( [ 'email' => 'your@email.com', // This is the only field required by sendy. 'name' => 'Name', // User name (optional). 'custom' => 'Field Value', // You can custom fields as well (optional). 'country' => 'US', // User 2 letter country code (optional). 'ipaddress' => 'XX.XX.XX.XXX', // User IP address (optional). 'referrer' => 'https://AhmadAwais.com/', // URL where the user signed up from (optional). 'gdpr' => true, // GDPR compliant? Set this to "true" (optional). ] );
Method #2: Unsubscribe
$responseArray = $sendy->unsubscribe( 'your@email.com' );
Method #3: Subscriber Status
$responseArray = $sendy->subStatus( 'your@email.com' );
Method #4: Delete Subscriber
$responseArray = $sendy->delete( 'your@email.com' );
Method #5: Subscriber Count of a list
$responseArray = $sendy->subCount();
Method #6: Campaign — Draft And/Or Send as well
// Method #6: Campaign — Draft And/Or Send as well. $responseArray = $sendy->campaign( array( 'from_name' => 'Your Name', 'from_email' => 'your@email.com', 'reply_to' => 'your@email.com', 'title' => 'Title', // the title of your campaign. 'subject' => 'Your Subject', 'plain_text' => 'An Amazing campaign', // Optional. 'html_text' => '<h1>Amazing campaign</h1>', 'brand_id' => 1, // Required only if you are creating a 'Draft' campaign. That is `send_campaign` set to 0. 'send_campaign' => 0, // SET: Draft = 0 and Send = 1 for the campaign. // Required only if you set send_campaign to 1 and no `segment_ids` are passed in.. List IDs should be single or comma-separated. 'list_ids' => 'XXXXXXXX, XXXXXXXX', // Required only if you set send_campaign to 1 and no `list_ids` are passed in. Segment IDs should be single or comma-separated. 'segment_ids' => '1', // Lists to exclude. List IDs should be single or comma-separated. (optional). 'exclude_list_ids' => '', // Segments to exclude. Segment IDs should be single or comma-separated. (optional). 'exclude_segments_ids' => '', 'query_string' => 'XXXXXXXX', // Eg. Google Analytics tags. ) );
Method #7: Set List ID
// Method #7: Change the `XXXXXXX` you are referring to at any point. $sendy->setListId( 'XXXXXXX' );
Method #8: Get List ID
// Method #7: Get the `XXXXXXX` you are referring to at any point. $sendy->getListId();
Response
The response of this PHP wrapper is custom-built. At the moment, it always returns a PHP Array. This array has the status of your action and an appropriate message in the response.
statusis eithertrueorfalse.messageis based on the type of action being performed
// E.g. SUCCESS response. [ 'status' => true, 'message' => 'Already Subscribed' ]; // E.g. FAIL response. [ 'status' => false, 'message' => 'Some fields are missing.' ];
Changelog
KEY: 📦 NEW, 👌 IMPROVE, 🐛 FIX, 📖 DOC, 🚀 RELEASE, and ✅ TEST
I use Emoji-log, you should try it and simplify your git commits.
License & Conduct
- MIT © Ahmad Awais
- Code of Conduct
- Props to Jacob Bennett for his initial work on the lib.
- Requires at least PHP 5.3.0 (otherwise remove the namespaces).
Connect
(follow) To stay up to date on free & open-source software
(follow) To get #OneDevMinute daily hot tips & trolls
(subscribe) To tech talks & #OneDevMinute videos
(read) In-depth & long form technical articles
(connect) On the LinkedIn profile y'all
Sponsor
Me (Ahmad Awais) and my incredible wife (Maedah Batool) are two engineers who fell in love with open source and then with each other. You can read more about me here. If you or your company use any of my projects or like what I’m doing then consider backing me. I'm in this for the long run. An open-source developer advocate.
cicerbro/sendy-php-api 适用场景与选型建议
cicerbro/sendy-php-api 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 10 次下载、GitHub Stars 达 0, 最近一次更新时间为 2024 年 08 月 07 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「api」 「newsletter」 「wrapper」 「Sendy」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 cicerbro/sendy-php-api 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 cicerbro/sendy-php-api 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 cicerbro/sendy-php-api 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
LinkedIn API PHP SDK with OAuth 2.0 & CSRF support. Can be used for social sign in or sharing on LinkedIn. Examples. Documentation.
LinkedIn API PHP SDK with OAuth 2.0 & CSRF support. Can be used for social sign in or sharing on LinkedIn. Examples. Documentation.
A PSR-7 compatible library for making CRUD API endpoints
Manage newsletters in Laravel
Sendrill DB
The Newsletter Module provides the newsletter features to manage newsletters and mailing lists.
统计信息
- 总下载量: 10
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 11
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-08-07




