hocza/sendy
最新稳定版本:1.1.1
Composer 安装命令:
composer require hocza/sendy
包简介
Sendy API implementation for Laravel
关键字:
README 文档
README
Sendy Laravel
A service provider for Sendy API in Laravel 5
Installation
composer require hocza/sendy:1.*
or append your composer.json with:
{
"require" : {
"hocza/sendy": "1.*"
}
}
Add the following settings to the config/app.php
Service provider:
'providers' => [ // ... 'Hocza\Sendy\SendyServiceProvider', ]
For the Sendy:: facade
'aliases' => [ // ... 'Sendy' => 'Hocza\Sendy\Facades\Sendy', ]
Configuration
php artisan vendor:publish --provider="Hocza\Sendy\SendyServiceProvider"
It will create sendy.php within the config directory.
<?php return [ 'listId' => '', 'installationUrl' => '', 'apiKey' => '', ];
Usage
Subscribe:
$data = [ 'email' => 'johndoe@example.com', 'name' => 'John Doe', 'any_custom_column' => 'value', ]; Sendy::subscribe($data);
RESPONSE (array)
In case of success:
['status' => true, 'message' => 'Subscribed'] ['status' => true, 'message' => 'Already subscribed']
In case of error:
['status' => false, 'message' => 'The error message']
Unsubscribe:
$email = 'johndoe@example.com'; Sendy::unsubscribe($email);
RESPONSE (array)
In case of success:
['status' => true, 'message' => 'Unsubscribed']
In case of error:
['status' => false, 'message' => 'The error message']
Subscription status
$email = 'johndoe@example.com'; Sendy::status($email);
RESPONSE (Plain text)
Success:
SubscribedUnsubscribedUnconfirmedBouncedSoft bouncedComplained
Error:
No data passedAPI key not passedInvalid API keyEmail not passedList ID not passedEmail does not exist in list
Active subscriber count
Sendy::count(); #To check other list: Sendy::setListId($list_id)->count();
RESPONSE (Plain text)
Success:
You'll get an integer of the active subscriber count
Error:
No data passedAPI key not passedInvalid API keyList ID not passedList does not exist
Create campaign
<?php $campaignOptions = [ 'from_name' => 'My Name', 'from_email' => 'test@mail.com', 'reply_to' => 'test@mail.com', 'title' => 'My Campaign', 'subject' => 'My Subject', 'list_ids' => '1,2,3', // comma-separated, optional 'brand_id' => 1, 'query_string' => 'utm_source=sendy&utm_medium=email&utm_content=email%20newsletter&utm_campaign=email%20newsletter', ]; $campaignContent = [ 'plain_text' => 'My Campaign', 'html_text' => View::make('mail.my-campaign'), ]; $send = false; Sendy::createCampaign($campaignOptions, $campaignContent, $send);
RESPONSE (Plain text)
Success:
Campaign createdCampaign created and now sending
Error:
No data passedAPI key not passedInvalid API keyFrom name not passedFrom email not passedReply to email not passedSubject not passedHTML not passedList ID(s) not passedOne or more list IDs are invalidList IDs does not belong to a single brandBrand ID not passedUnable to create campaignUnable to create and send campaign
Change list ID
To change the default list ID simply prepend with setListId($list_id)
Examples:
Sendy::setListId($list_id)->subscribe($data); Sendy::setListId($list_id)->unsubscribe($email); Sendy::setListId($list_id)->status($email); Sendy::setListId($list_id)->count();
Todo
- Implementing the rest of the API. :)
- better documentation - in progress as you can see :)
Buy me a coffee :)
hocza/sendy 适用场景与选型建议
hocza/sendy 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 187.9k 次下载、GitHub Stars 达 71, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「api」 「newsletter」 「email」 「laravel」 「Sendy」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 hocza/sendy 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 hocza/sendy 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 hocza/sendy 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A PSR-7 compatible library for making CRUD API endpoints
Manage newsletters in Laravel
Extensible library for building notifications and sending them via different delivery channels.
Email+ extends Kirby's email capabilities by adding support for multiple email services using the same Kirby email API.
Sendrill DB
The Newsletter Module provides the newsletter features to manage newsletters and mailing lists.
统计信息
- 总下载量: 187.9k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 74
- 点击次数: 25
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 未知