2017 © Pedro Peláez
 

symfony-bundle campaign-monitor-bundle

Symfony bundle for the Campaign Monitor API

image

intracto/campaign-monitor-bundle

Symfony bundle for the Campaign Monitor API

  • Tuesday, November 28, 2017
  • by tvlooy
  • Repository
  • 23 Watchers
  • 3 Stars
  • 1,512 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 2 Forks
  • 0 Open issues
  • 6 Versions
  • 25 % Grown

The README.md

IntractoCampaignMonitorBundle

Welcome to the IntractoCampaignMonitorBundle - a Symfony wrapper for the Campaign Monitor PHP library., (*1)

For details on how to get started with IntractoCampaignMonitorBundle, keep on reading., (*2)

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., (*3)

All code included in the IntractoCampaignMonitorBundle is released under the MIT or BSD license., (*4)

Installation

Step 1 - Install IntractoCampaignMonitorBundle using composer

Edit your composer.json to include the bundle as a dependency., (*5)

{
    "require": {
        "intracto/campaign-monitor-bundle": "0.1",
    }
}

Open up a command line window and tell composer to download the new dependency., (*6)

``` bash $ php composer.phar update intracto/campaign-monitor-bundle, (*7)


### Step 2 - Register the bundle in your AppKernel file ``` php <?php // app/AppKernel.php public function registerBundles() { $bundles = array( ... new Intracto\CampaignMonitorBundle\IntractoCampaignMonitorBundle(), ); }

Configure the bundle to use your Campaign Monitor API key

``` yml // app/config/config.yml, (*8)

intracto_campaign_monitor: api_key: YOUR_API_KEY, (*9)


## 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 <?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., (*10)

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., (*11)

Not all methods of the CampaignMonitor API are available yet. If some are missing, feel free to open up an issue., (*12)

Pull requests are also greatly appreciated!, (*13)

The Versions

28/11 2017

dev-master

9999999-dev

Symfony bundle for the Campaign Monitor API

  Sources   Download

MIT

The Requires

 

28/11 2017

v0.5

0.5.0.0

Symfony bundle for the Campaign Monitor API

  Sources   Download

MIT

The Requires

 

04/08 2017

v0.4

0.4.0.0

Symfony bundle for the Campaign Monitor API

  Sources   Download

MIT

The Requires

 

31/01 2017

v0.3

0.3.0.0

Symfony bundle for the Campaign Monitor API

  Sources   Download

MIT

The Requires

 

06/11 2016

v0.2

0.2.0.0

Symfony bundle for the Campaign Monitor API

  Sources   Download

MIT

The Requires

 

22/07 2016

v0.1

0.1.0.0

Symfony bundle for the Campaign Monitor API

  Sources   Download

MIT

The Requires