sendinblue/api-bundle

Symfony bundle for sendinblue/api-v3-sdk

Installs: 65 454

Dependents: 1

Suggesters: 0

Security: 0

Stars: 14

Watchers: 6

Forks: 6

Open Issues: 5

Type:symfony-bundle

1.4.0 2018-03-23 13:00 UTC

This package is not auto-updated.

Last update: 2020-08-08 05:40:14 UTC


README

This bundle integrates sendinblue/api-v3-sdk into Symfony.

Installation

Step 1: Download the Bundle

Open a command console, enter your project directory and execute the following command to download the latest stable version of this bundle:

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

This command requires you to have Composer installed globally, as explained in the installation chapter of the Composer documentation.

Step 2: Enable the Bundle

Then, enable the bundle by adding it to the list of registered bundles in the app/AppKernel.php file of your project:

<?php
// app/AppKernel.php

// ...
class AppKernel extends Kernel
{
    public function registerBundles()
    {
        $bundles = array(
            // ...

            new SendinBlue\Bundle\ApiBundle\SendinBlueApiBundle(),
        );

        // ...
    }

    // ...
}

Configuration

sendinblue_api:
    endpoints: []
    key: ~

You’ll define the API client key under sendinblue_api.key.

Then you’ll need to otp-in for the endpoints you want to access. One service will be created per endpoint:

  • account
  • attributes
  • contacts
  • email_campaigns
  • folders
  • lists
  • process
  • reseller
  • senders
  • sms_campaigns
  • smtp
  • transactional_sms
  • webhooks

The service names will be sendinblue_api.%s_endpoint where %s is a value from the list above. The corresponding classes can be found under the SendinBlue\Client\Api namespace.

/** @var SendinBlue\Client\Api\AccountApi $accountEndpoint */
$accountEndpoint = $this->get('sendinblue_api.account_endpoint');

Multiple clients

To use more than one client you must move key and endpoints parameter under a clients associative array. Each client will be named by its key.

sendinblue_api:
    clients:
        first:
            endpoints:
                - account
            key: ~
        second:
            endpoints:
                - account
            key: ~

To access the first client account endpoint you’ll get the sendinblue_api.first_client.account_endpoint service.

Default client

You can define a default client through the default_client parameter; by default it is the first defined client. You can access the default client endpoints without adding its name in the service name. In the above example the sendinblue_api.account_endpoint service would be an alias of sendinblue_api.first_client.account_endpoint.

If you write

sendinblue_api:
    default_client: second
    clients:
        first:
            endpoints:
                - account
            key: ~
        second:
            endpoints:
                - account
            key: ~

then sendinblue_api.account_endpoint will be an alias of sendinblue_api.second_client.account_endpoint.