matperez/yii2unisender

yii2 unisender extension

Installs: 5 799

Dependents: 0

Suggesters: 0

Security: 0

Stars: 4

Watchers: 2

Forks: 2

Open Issues: 0

Type:yii2-extension

1.1.2 2017-01-31 06:50 UTC

This package is not auto-updated.

Last update: 2024-05-08 22:07:32 UTC


README

yii2 unisender extension

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require --prefer-dist matperez/yii2unisender "~1.0"

or add

"matperez/yii2unisender": "~1.0"

to the require section of your composer.json file.

Usage

Once the extension is installed, simply use it in your code by :

    'components' => [
      'unisender' => [
        'class' => \matperez\yii2unisender\UniSender::class,
        'apiConfig' => [
          'apiKey' => '...'
        ],
    ]
    

You can also use it with the dependency container:

    Yii::$container->setSingleton(\matperez\yii2unisender\UniSenderInterface::class, function() {
        return Yii::$app->unisender;
    });
  

For now it's supports the following operations:

Get a user fields array:

    $fields = $unisender->getFields()->getResult;

Get an available subscriptions list:

    $list = $unisender->getLists()->getResult();
  

Create a new subscription:

    $sub = new Subscriber($name, $email, $phone);
    $sub->addTag('something');
    $response = $unisender->subscribe($sub, [12315, 14333]);
    if ($response->isSuccess()) {
      $personId = $response->getResult()['person_id'];
      // .... do something with the person id
    }
  

Get the "native" API instance:

    $api = $unisender->getApi();
    $api->doSomethingViaMagicCall();
  

Tests

Just run phpunit