Coder Social home page Coder Social logo

sendy-laravel's Introduction

Sendy

sendy-laravel

A service provider for Sendy API in Laravel 5

Latest Stable Version Total Downloads Latest Unstable Version License

Installation

composer require hocza/sendy:1.*

or append your composer.json with:

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

Add the following settings to the config/app.php

Service provider:

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

For the Sendy:: facade

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

Configuration

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

It will create sendy.php within the config directory.

<?php
return [
    'listId' => '',
    'installationUrl' => '',
    'apiKey' => '',
];

Usage

###Subscribe:

$data = [
	'email' => '[email protected]',
	'name' => 'John Doe',
	'any_custom_column' => 'value'
];
Sendy::subscribe($data);

RESPONSE (array)

In case of success:

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

In case of error:

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

###Unsubscribe:

$email = '[email protected]';
Sendy::unsubscribe($email);

RESPONSE (array)

In case of success:

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

In case of error:

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

###Subscription status

$email = '[email protected]';
Sendy::status($email);

RESPONSE (Plain text)

Success: Subscribed

Success: Unsubscribed

Success: Unconfirmed

Success: Bounced

Success: Soft bounced

Success: Complained

Error: No data passed

Error: API key not passed

Error: Invalid API key

Error: Email not passed

Error: List ID not passed

Error: Email does not exist in list

###Active subscriber count

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

RESPONSE (Plain text)

Success: You'll get an integer of the active subscriber count

Error: No data passed

Error: API key not passed

Error: Invalid API key

Error: List ID not passed

Error: List does not exist

###Create campaign

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

###Change list ID

To change the default list ID simply prepend with setListId($list_id)
Examples:
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 :)

sendy-laravel's People

Contributors

hocza avatar alisonmonteiro avatar michellaurent avatar

Watchers

James Cloos avatar Nguyen Kim Trien avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.