karacweb/infomaniak-newsletter
Composer 安装命令:
composer require karacweb/infomaniak-newsletter
包简介
Implementation of the Infomaniak's newsletter service for Laravel
README 文档
README
Infomaniak Newsletter for Laravel helps you interact with Infomaniak's API.
Installation
Install the package through Composer.
Run the Composer require command from the terminal:
composer require karacweb/infomaniak-newsletter
Publish the configuration using the following command:
php artisan vendor:publish --provider="Karacweb\InfomaniakNewsletter\ServiceProvider"
Configuration
Set your env keys and list(s) id(s) in config/infomaniak-newsletter.php.
return [ /* * The API keys of an Infomaniak newsletter account. You can find yours at * https://newsletter.infomaniak.com/accounts/access-token */ 'apiKey' => env('INFOMANIAK_APIKEY'), 'secretKey' => env('INFOMANIAK_SECRETKEY'), /* * The listName to use when no listName has been specified in a method. */ 'defaultListName' => 'subscribers', /* * Here you can define properties of the lists. */ 'lists' => [ /* * This key is used to identify this list. It can be used * as the listName parameter provided in the various methods. * * You can set it to any string you want and you can add * as many lists as you want. */ 'subscribers' => [ /* * Id of a newsletter contact list. You can retrieve it * by looking at the last characters of the list's URL : * https://newsletter.infomaniak.com/mailinglists/show/XXXXX */ 'id' => env('INFOMANIAK_LISTID'), ], ], ];
Usage
NewsletterInfomaniak::importContact()
Subscribe an email address to the default list.
use InfomaniakNewsletter; InfomaniakNewsletter::importContact("email@example.com");
Provide a firstname and a lastname as an optional parameter.
InfomaniakNewsletter::importContact("email@example.com", ["firstname" => "John", "lastname" => "Doe"]);
Finally, choose the list to add the email to as a third parameter.
InfomaniakNewsletter::importContact("email@example.com", [], "subscribers");
NewsletterInfomaniak::isSubscribed()
Check if the email is subscribed to the default list.
InfomaniakNewsletter::isSubscribed("email@example.com");
Check if the email is subscribed in the subscribers list.
InfomaniakNewsletter::isSubscribed("email@example.com", "subscribers");
NewsletterInfomaniak::unsubscribeContact()
Unsubscribe an email from the default list. The contact is not deleted, only its status change.
InfomaniakNewsletter::unsubscribeContact("email@example.com");
Unsubscribe an email from the subscribers list.
InfomaniakNewsletter::unsubscribeContact("email@example.com", "subscribers");
NewsletterInfomaniak::deleteContact()
Remove an email from the default list.
InfomaniakNewsletter::deleteContact("email@example.com");
Remove an email from the subscribers list
InfomaniakNewsletter::deleteContact("email@example.com", "subscribers");
NewsletterInfomaniak::getContact()
Get the data regarding a contact.
InfomaniakNewsletter::getContact("email@example.com");
NewsletterInfomaniak::getContacts()
Get the contacts from the default list. The result is paginated.
InfomaniakNewsletter::getContacts();
Get the contacts from the subscribers list.
InfomaniakNewsletter::getContacts("subscribers");
Get the contact from the subscribers list with specified pagination options.
InfomaniakNewsletter::getContacts("subscribers", ["page" => 2, "perPage" => 50]);
NewsletterInfomaniak::updateContact()
Update the firstname of a contact. This updates the contacts in all the mailing lists of the account.
InfomaniakNewsletter::updateContact("email@example.com", ["firstname" => "Joe"]);
You can provide a lastname too.
InfomaniakNewsletter::updateContact("email@example.com", ["firstname" => "Joe", "lastname" => "Donovan"]);
NewsletterInfomaniak::getMailinglists()
Get the account's mailing lists. The result is paginated.
InfomaniakNewsletter::getMailinglists();
Get the account's mailing lists with specified pagination options.
InfomaniakNewsletter::getMailinglists(["page" => 1, "perPage" => 50]);
NewsletterInfomaniak::getMailinglist()
Get the information of the default list.
InfomaniakNewsletter::getMailinglist();
Get the information of the subscribers list.
InfomaniakNewsletter::getMailinglist("subscribers");
NewsletterInfomaniak::createMailinglist()
Create the subscribers_fr mailing list.
InfomaniakNewsletter::createMailinglist("subscribers_fr");
NewsletterInfomaniak::updateMailinglist()
Rename the subscribers_fr mailing list to subscribers_french.
InfomaniakNewsletter::updateMailinglist("subscribers_fr", "subscribers_french");
NewsletterInfomaniak::deleteMailinglist()
Delete the default list.
InfomaniakNewsletter::deleteMailinglist();
Delete the subscribers_french mailing list.
InfomaniakNewsletter::deleteMailinglist("subscribers_french");
NewsletterInfomaniak::getTask()
Get information about the task 123456.
InfomaniakNewsletter::getTask(123456);
karacweb/infomaniak-newsletter 适用场景与选型建议
karacweb/infomaniak-newsletter 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1.84k 次下载、GitHub Stars 达 1, 最近一次更新时间为 2021 年 12 月 30 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 karacweb/infomaniak-newsletter 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 karacweb/infomaniak-newsletter 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 1.84k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 13
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2021-12-30