Skip to content

jkabat/sendy-bundle

Repository files navigation

SendyBundle

Scrutinizer Code Quality Build Status

This bundle is used to integrate the SendyPHP class from Jacob Bennett into a symfony2 project.

Installation

Step 1: Download the Bundle

Open a command console, enter your project directory and execute the following command to download the latest stable version of this bundle:

$ composer require jkabat/sendy-bundle

This command requires you to have Composer installed globally, as explained in the installation chapter of the Composer documentation.

Step 2: Enable the Bundle

Then, enable the bundle by adding the following line in the app/AppKernel.php file of your project:

<?php
// app/AppKernel.php

// ...
class AppKernel extends Kernel
{
    public function registerBundles()
    {
        $bundles = [
            // ...

            new Sendy\SendyBundle\SendyBundle(),
        ];

        // ...
    }

    // ...
}

Step 3: Configure sendy_manager Service

# app/config/config.yml
sendy:
    api_key: sendy_api_key
    api_host: https://sendy.installation.url
    list_id: default_list_id

Usage

Get count of total active subscribers for default list:

// get service
$sendy = $this->container->get('sendy.sendy_manager');
$count = $sendy->getSubscriberCount();

Get count of total active subscribers for other list:

$sendy = $this->container->get('sendy.sendy_manager');
$count = $sendy->getSubscriberCount('other_list_id');

Get status of subscriber identified by e-mail:

$sendy = $this->container->get('sendy.sendy_manager');
$status = $sendy->getSubscriberStatus('[email protected]');

Subscribe user to default list (other list id can be used as third parameter):

$sendy = $this->container->get('sendy.sendy_manager');
$status = $sendy->subscribe('Name', '[email protected]');

Unsubscribe user from default list (other list id can be used as second parameter):

$sendy = $this->container->get('sendy.sendy_manager');
$status = $sendy->unsubscribe('[email protected]');

About

Symfony2 bundle that integrates SendyPHP class from Jacob Bennett: https://github.com/JacobBennett/SendyPHP.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages