Coder Social home page Coder Social logo

cooptilleuls / cooptilleulsymlpbundle Goto Github PK

View Code? Open in Web Editor NEW
4.0 23.0 1.0 23 KB

Integrates YMLP API for Symfony

Home Page: http://les-tilleuls.coop

License: MIT License

PHP 100.00%
ymlp ymlp-api api symfony symfony-bundle php guzzle newsletter symfony2 symfony3

cooptilleulsymlpbundle's Introduction

CoopTilleulsYmlpBundle, YMLP API for Symfony

This bundle integrates the Your Mailing List Provider (YMLP) API into Symfony projects.

Latest Stable Version Build Status SensioLabsInsight

Installation

Use Composer to install this bundle:

composer require tilleuls/ymlp-bundle

Add the bundle in your application kernel:

// app/AppKernel.php

public function registerBundles()
{
    return [
        // ...
        new CoopTilleuls\Bundle\YmlpBundle\CoopTilleulsYmlpBundle(),
        // ...
    ];
}

Configuration

# app/config/config.yml

coop_tilleuls_ymlp:
    # YMLP URL for API calls (default to https://www.ymlp.com/api/)
    api_url: https://www.ymlp.com/api/
    # Your YMLP API key (no default)
    api_key: YOURSECRETAPIKEY1234
    # Your YMLP username (no default)
    api_username: tilleuls

Usage

use CoopTilleuls\Bundle\YmlpBundle\Ymlp\Exception\YmlpException;

// Get an instance of the YMLP API client as a service
$ymlpClient = $this->get('coop_tilleuls_ymlp.client');

// Call the simple Ping() command of the YMLP API
$pingResponse = $ymlpClient->call('Ping');

// Add a new contact to one or more groups with exception handling
try {
    $contactsAddResponse = $ymlpClient->call('Contacts.Add', ['Email' => '[email protected]', 'GroupID' => 1]);
} catch (YmlpException $e) {
    //...
}

The call() method returns an array containing the response or throws an exception of type \CoopTilleuls\Bundle\YmlpBundle\Ymlp\Exception\YmlpException.

You can obtain a list of all the commands of the API, their parameters and their responses on the YMLP API page (require YMLP credentials).

Credits

This bundle has been written by Baptiste Meyer for Les-Tilleuls.coop.

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.