smartsender/smartsender-php

PHP client for SmartSender API v3

0.9.4 2019-05-15 12:10 UTC

This package is auto-updated.

Last update: 2024-08-18 04:05:52 UTC


README

Installation

composer require smartsender/smartsender-php

or add to your composer.json file next row and then execute "composer install" command

"require": {
  ...
  "smartsender/smartsender-php": ">=0.9.4",
  ...
}

SmartSender API version 3

The SmartSender API can be found here.

Getting Started

$accessToken = new \SmartSender\V3\Auth\AccessToken('putYourAccessTokenHere');
$adapter = new \SmartSender\V3\Adapter\CurlAdapter($accessToken);

$mailer = new \SmartSender\V3\Client\Mailer($adapter);
        
try {
    
    // Almost all declared methods can throw an Exception, so you can catch it
    
    $email = new \SmartSender\V3\Email\Email();
        // Set parameters of Email
        // ...
                    
    $email = $mailer->sendEmail($email);
    echo $email->getId();
    
} catch(\SmartSender\V3\Exceptions\SmartSenderException $e) {
    echo $e->getMessage();
}

SDK Documentation

If you don't want to deal with objects and all you need is arrays of parameters, you can use adapter's request() method in conjunction with SmartSender API documentation Example you can find here

Note that this repository is currently under development, additional classes and endpoints being actively added.