PHP code example of tilleuls / ymlp-bundle

1. Go to this page and download the library: Download tilleuls/ymlp-bundle library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

tilleuls / ymlp-bundle example snippets


// app/AppKernel.php

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

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) {
    //...
}