intracto/campaign-monitor-bundle
Composer 安装命令:
composer require intracto/campaign-monitor-bundle
包简介
Symfony bundle for the Campaign Monitor API
README 文档
README
Welcome to the IntractoCampaignMonitorBundle - a Symfony wrapper for the Campaign Monitor PHP library.
For details on how to get started with IntractoCampaignMonitorBundle, keep on reading.
What's inside?
The IntractoCampaignMonitorBundle has following features:
- All results from the API are hydrated to different models.
- Paged results are returned as a Paginator instance with a method to get the next set of records.
- A defensive programming approach in all classes to prevent broken instances.
All code included in the IntractoCampaignMonitorBundle is released under the MIT or BSD license.
Installation
Step 1 - Install IntractoCampaignMonitorBundle using composer
Edit your composer.json to include the bundle as a dependency.
{ "require": { "intracto/campaign-monitor-bundle": "0.1", } }
Open up a command line window and tell composer to download the new dependency.
$ php composer.phar update intracto/campaign-monitor-bundle
Step 2 - Register the bundle in your AppKernel file
<?php // app/AppKernel.php public function registerBundles() { $bundles = array( ... new Intracto\CampaignMonitorBundle\IntractoCampaignMonitorBundle(), ); }
Configure the bundle to use your Campaign Monitor API key
// app/config/config.yml intracto_campaign_monitor: api_key: YOUR_API_KEY
Usage
There are 4 factory services at your disposal.
- itr.campaign_monitor.factory.client_connector
- itr.campaign_monitor.factory.list_connector
- itr.campaign_monitor.factory.segment_connector
- itr.campaign_monitor.factory.campaign_connector
Each of these services implements the ConnectorFactory interface, which has one public method 'getConnectorForId', which accepts an id in the form of a string and returns a Connector.
Here is an example of how to use the ClientConnectorFactory service.
<?php use Symfony\Bundle\FrameworkBundle\Controller\Controller; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; class ClientController extends Controller { /** * @var Request $request * @return Response */ public function subscriberListsAction(Request $request) { $clientConnectorFactory = $this->get('itr.campaign_monitor.factory.client_connector'); $clientId = $this->getParameter('your_client_id'); $clientConnector = $clientConnectorFactory->getConnectorForId($clientId); /** @var ListReference[]|ArrayCollection $lists */ $lists = $clientConnector->getLists(); return $this->render('your_template_file.html.twig', ['lists' => $lists]); } ... }
Have a look inside the Connector classes to check out what methods are available. Nearly all methods will return a response in OOP-style.
Paginated results like subscribers lists, will be put into a Paginator instance. This class has a next() method, that will execute another request to the Campaign Monitor API for the next page.
Not all methods of the CampaignMonitor API are available yet. If some are missing, feel free to open up an issue.
Pull requests are also greatly appreciated!
intracto/campaign-monitor-bundle 适用场景与选型建议
intracto/campaign-monitor-bundle 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 4.77k 次下载、GitHub Stars 达 4, 最近一次更新时间为 2016 年 07 月 22 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 intracto/campaign-monitor-bundle 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 intracto/campaign-monitor-bundle 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 4.77k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 5
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2016-07-22