lukaszmordawski/campaign-monitor-bundle
Symfony bundle that integrates Campaign Monitor's email marketing API into your PHP application. Manage subscriber lists, campaigns, and transactional emails through configured services, with a lightweight wrapper that simplifies API setup and keeps email marketing operations accessible from your Sy...
Install (assuming a Symfony 2.x project):
composer require lukaszmordawski/campaign-monitor-bundle
Register the bundle in app/AppKernel.php:
public function registerBundles()
{
$bundles = [
// ...
new LukaszMordawski\CampaignMonitorBundle\CampaignMonitorBundle(),
];
return $bundles;
}
Configure credentials in app/config/config.yml (naming may vary slightly by version — check DependencyInjection/Configuration.php in the bundle source, which is the authoritative reference):
campaign_monitor:
api_key: "%campaign_monitor_api_key%"
Keep the key in parameters.yml and never commit it.
Look here first inside the bundle:
DependencyInjection/ — the extension and Configuration.php define the config tree and service wiring. This is your source of truth for service IDs and options.Resources/config/services.xml (or .yml) — tells you exactly what service ID to fetch.composer.json — shows the pinned Campaign Monitor SDK (campaignmonitor/createsend-php) version.First use case — fetch the client and pull a subscriber list:
$client = $this->get('campaign_monitor')->getClient(); // adjust to actual service ID
$lists = $client->getLists();
In a controller (Symfony 2 style) use $this->get('...'); in a service, inject the ID via services.yml.
App\Service\CampaignMonitorGateway) so controllers never touch Campaign Monitor objects directly. This makes the bundle swappable when it inevitably can't keep up with SDK/version changes.dev/test API key at a sandbox Campaign Monitor account so you don't fire real campaigns or pollute live lists while iterating.Command and call the wrapper service rather than embedding it in a controller — this avoids request timeouts and lets you schedule via cron.addSubscriber/importSubscribers batch methods where possible; wrap calls with a small queue entry (e.g., a Subscriber entity + Doctrine) so failed API calls can be retried.CurlException, BadRequestException). Catch them in your gateway and rethrow app-level exceptions so callers aren't coupled to the SDK.Configuration.php, override the service definition in your own services.yml (same ID, updated arguments) rather than editing vendor code.campaignmonitor/createsend-php directly — the bundle adds little value beyond one service definition.php app/console debug:container campaign_monitor (Symfony 2.x) or grep services.xml to confirm the actual ID before wiring it up.composer.json pins an old SDK. If you need a newer API feature, you'll have to bump the SDK yourself and may hit breaking changes in class names/method signatures the bundle was written against.config.yml gets committed; use parameters.yml + environment overrides. Also set campaign_monitor: ~ in config_test.yml so unit tests don't try to hit the network.usleep) or use the importSubscribers bulk endpoints; hammering the wrapper will get you 400s that surface as opaque SDK exceptions.AppKernel registration happened before the container is compiled and that you haven't disabled the extension via campaign_monitor: false.How can I help you explore Laravel packages today?