tzb / sendy-bundle
Symfony bundle that integrates SendyPHP library from Jacob Bennett: https://github.com/JacobBennett/SendyPHP.
Installs: 140
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 1
Type:symfony-bundle
Requires
- php: >=7.4
- jacobbennett/sendyphp: ~2.0
- symfony/framework-bundle: ^4.4|^5.4|^6.0
- symfony/yaml: ^4.4|^5.4|^6.0
Requires (Dev)
- phpstan/phpstan: ^1.5
- phpstan/phpstan-strict-rules: ^1.1
- phpstan/phpstan-symfony: ^1.1
- phpunit/phpunit: ^9.5
- symfony/phpunit-bridge: ^5.4|^6.0
- symplify/easy-coding-standard: ^10.1
This package is not auto-updated.
Last update: 2024-11-02 16:56:59 UTC
README
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@example.com');
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@example.com');
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@example.com');