Skip to content

matperez/yii2-unisender

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

yii2 unisender

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

About

another one yii2 unisender client

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages