sendinblue/sendinblue-api-bundle

This package is abandoned and no longer maintained. The author suggests using the sendinblue/api-bundle package instead.

Official SendinBlue provided API V2 Symfony 2.x & 3.x Bundle

Installs: 213 229

Dependents: 1

Suggesters: 0

Security: 0

Stars: 14

Watchers: 5

Forks: 10

Open Issues: 7

Type:symfony-bundle

v2.0.10 2017-01-04 12:50 UTC

README

Note: The latest API V3.0 ( LTS ) is now maintained at https://github.com/sendinblue/ and the Documentation is available here https://developers.sendinblue.com

This is SendinBlue provided API V2 Symfony Bundle. It implements the various exposed APIs that you can read more about on https://apidocs.sendinblue.com.

Prerequisites

This version of the bundle requires Symfony 2.x OR 3.x.

Installation

Download SendinBlueApiBundle using composer

Add SendinBlueApiBundle in your composer.json:

        "require": {
            "sendinblue/sendinblue-api-bundle": "2.0.*"
        }
    }```

Now tell composer to download the bundle by running the command:

```bash
$ composer update

OR

Simply install by running below command

$ composer require "sendinblue/sendinblue-api-bundle"

Composer will install the bundle to your project's vendor/sendinblue directory.

Enable the Bundle

In the kernel app/AppKernel.php:

<?php

public function registerBundles()
{
    $bundles = array(
        // ...
        new SendinBlue\SendinBlueApiBundle\SendinBlueApiBundle(),
    );
}

Add SendinBlue Api key

In your app/config/config.yml:

sendin_blue_api:
    api_key: <Your access key>
    # Our library supports a timeout value, which is an optional parameter, default is 30,000 MS ( 30 secs )
    timeout: 5000

Usage

The API is available with the sendinblue_api service. To access it, add in your controller (or elsewhere):

<?php
$sendinblue = $this->get('sendinblue_api');

Example

Get your account information

<?php
$sendinblue = $this->get('sendinblue_api');

$result = $sendinblue->get_account();
// var_dump($result);

To send email

<?php

$sendinblue = $this->get('sendinblue_api');

$data = array( "to" => array("to@example.net"=>"to whom!"),
    "cc" => array("cc@example.net"=>"cc whom!"),
    "bcc" => array("bcc@example.net"=>"bcc whom!"),
    "replyto" => array("replyto@email.com","reply to!"),
    "from" => array("from@email.com","from email!"),
    "subject" => "My subject",
    "text" => "This is the text",
    "html" => "This is the <h1>HTML</h1><br/>
               This is inline image 1.<br/>
               <img src=\"{myinlineimage1.png}\" alt=\"image1\" border=\"0\"><br/>
               Some text<br/>
               This is inline image 2.<br/>
               <img src=\"{myinlineimage2.jpg}\" alt=\"image2\" border=\"0\"><br/>
               Some more text<br/>
               Re-used inline image 1.<br/>
               <img src=\"{myinlineimage1.png}\" alt=\"image3\" border=\"0\">",
    "attachment" => array(),
    "headers" => array("Content-Type"=> "text/html; charset=iso-8859-1","X-param1"=> "value1", "X-param2"=> "value2","X-Mailin-custom"=>"my custom value", "X-Mailin-IP"=> "102.102.1.2", "X-Mailin-Tag" => "My tag"),
    "inline_image" => array("myinlineimage1.png" => "your_png_files_base64_encoded_chunk_data","myinlineimage2.jpg" => "your_jpg_files_base64_encoded_chunk_data")
);

$result = $sendinblue->send_email($data);
// var_dump($result);

Support and Feedback

Be sure to visit the SendinBlue official documentation website for additional information about our API.

If you find a bug, please submit the issue in Github directly.

As always, if you need additional assistance, drop us a note here.