2017 © Pedro Peláez
 

library sendy

Sendy API implementation for Laravel

image

hocza/sendy

Sendy API implementation for Laravel

  • Monday, October 30, 2017
  • by hocza
  • Repository
  • 5 Watchers
  • 54 Stars
  • 32,076 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 12 Forks
  • 3 Open issues
  • 3 Versions
  • 7 % Grown

The README.md

Sendy, (*1)

Sendy Laravel

A service provider for Sendy API in Laravel 5, (*2)

Latest Stable Version Total Downloads Latest Unstable Version License, (*3)

Installation

composer require hocza/sendy:1.*

or append your composer.json with:, (*4)

{
    "require" : {
        "hocza/sendy": "1.*"
    }
}

Add the following settings to the config/app.php, (*5)

Service provider:, (*6)

'providers' => [
    // ...
    'Hocza\Sendy\SendyServiceProvider',
]

For the Sendy:: facade, (*7)

'aliases' => [
    // ...
    'Sendy' => 'Hocza\Sendy\Facades\Sendy',
]

Configuration

php artisan vendor:publish --provider="Hocza\Sendy\SendyServiceProvider"

It will create sendy.php within the config directory., (*8)

<?php

return [

    'listId' => '',
    'installationUrl' => '',
    'apiKey' => '',

];

Usage

Subscribe:

$data = [
    'email' => 'johndoe@example.com',
    'name' => 'John Doe',
    'any_custom_column' => 'value',
];

Sendy::subscribe($data);

RESPONSE (array), (*9)

In case of success:, (*10)

['status' => true, 'message' => 'Subscribed']
['status' => true, 'message' => 'Already subscribed']

In case of error:, (*11)

['status' => false, 'message' => 'The error message']

Unsubscribe:

$email = 'johndoe@example.com';
Sendy::unsubscribe($email);

RESPONSE (array), (*12)

In case of success:, (*13)

['status' => true, 'message' => 'Unsubscribed']

In case of error:, (*14)

['status' => false, 'message' => 'The error message']

Subscription status

$email = 'johndoe@example.com';
Sendy::status($email);

RESPONSE (Plain text), (*15)

Success:, (*16)

  • Subscribed
  • Unsubscribed
  • Unconfirmed
  • Bounced
  • Soft bounced
  • Complained

Error:, (*17)

  • No data passed
  • API key not passed
  • Invalid API key
  • Email not passed
  • List ID not passed
  • Email does not exist in list

Active subscriber count

Sendy::count();
#To check other list:
Sendy::setListId($list_id)->count();

RESPONSE (Plain text), (*18)

Success:, (*19)

  • You'll get an integer of the active subscriber count

Error:, (*20)

  • No data passed
  • API key not passed
  • Invalid API key
  • List ID not passed
  • List does not exist

Create campaign

<?php

$campaignOptions = [
    'from_name' => 'My Name',
    'from_email' => 'test@mail.com',
    'reply_to' => 'test@mail.com',
    'title' => 'My Campaign',
    'subject' => 'My Subject',
    'list_ids' => '1,2,3', // comma-separated, optional
    'brand_id' => 1,
    'query_string' => 'utm_source=sendy&utm_medium=email&utm_content=email%20newsletter&utm_campaign=email%20newsletter',
];
$campaignContent = [
    'plain_text' => 'My Campaign',
    'html_text' => View::make('mail.my-campaign'),
];
$send = false;

Sendy::createCampaign($campaignOptions, $campaignContent, $send);

RESPONSE (Plain text), (*21)

Success:, (*22)

  • Campaign created
  • Campaign created and now sending

Error:, (*23)

  • No data passed
  • API key not passed
  • Invalid API key
  • From name not passed
  • From email not passed
  • Reply to email not passed
  • Subject not passed
  • HTML not passed
  • List ID(s) not passed
  • One or more list IDs are invalid
  • List IDs does not belong to a single brand
  • Brand ID not passed
  • Unable to create campaign
  • Unable to create and send campaign

Change list ID

To change the default list ID simply prepend with setListId($list_id)
Examples:, (*24)

Sendy::setListId($list_id)->subscribe($data);
Sendy::setListId($list_id)->unsubscribe($email);
Sendy::setListId($list_id)->status($email);
Sendy::setListId($list_id)->count();

Todo

  • Implementing the rest of the API. :)
  • better documentation - in progress as you can see :)

Buy me a coffee :)

Click here to lend your support to: Sendy-laravel and make a donation at pledgie.com !, (*25)

The Versions

30/10 2017

dev-master

9999999-dev

Sendy API implementation for Laravel

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

by Jozsef Hocza

laravel api newsletter email sendy

30/10 2017

1.1.0

1.1.0.0

Sendy API implementation for Laravel

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

by Jozsef Hocza

laravel api newsletter email sendy

07/12 2015

1.0.0

1.0.0.0

Sendy API implementation for Laravel

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

by Jozsef Hocza

laravel api newsletter email sendy