2017 © Pedro Peláez
 

symfony-bundle mail-xpertise-bundle

A symfony bundle to handle mailxpertise api

image

jihel/mail-xpertise-bundle

A symfony bundle to handle mailxpertise api

  • Monday, March 20, 2017
  • by Jihel
  • Repository
  • 1 Watchers
  • 0 Stars
  • 40 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 5 % Grown

The README.md

MailXpertise Api

A Symfony bundle to handle mail expertise api. This bundle only provide a php object way to use the api with Guzzle., (*1)

1- Install

Add plugin to your composer.json require:, (*2)

{
    "require": {
        "jihel/mail-xpertise-bundle": "dev-master",
    }
}

or, (*3)

php composer.phar require jihel/mail-xpertise-bundle:dev-master

Add bundle to your AppKernel.php, (*4)

public function registerBundles()
{
    $bundles = array(
        ...
        new Jihel\Plugin\MailXpertiseBundle\JihelPluginMailXpertise(),
    );
}

2- Configure your config.yml

The default configuration file and explanations can be found here, (*5)

jihel_plugin_mail_xpertise:
    apiKey: your_api_key
    token: your_api_token
    timeout: 3

3- Usage

Get the proxy service jihel.plugin.mail_xpertise.proxy.api:, (*6)

  • From a controller, (*7)

    /** @var \Jihel\Plugin\MailXpertiseBundle\Proxy\ApiProxy $MailXpertiseProxy */ $MailXpertiseProxy = $this->get('jihel.plugin.mail_xpertise.proxy.api');, (*8)

  • From a service, (*9)

    service: my.super.service: class: %my.super.service.class% arguments: { '@jihel.plugin.mail_xpertise.proxy.api' }, (*10)

The class provite one methods that will return a Guzzle Client object, (*11)

/**
 * Get the Guzzle client object.
 * Aditionnal options can be provide, it won't override the one defined by config 
 *
 * @param array $option
 * @return \SplFileObject
 */
public function getClient(array $option = array())

Example:, (*12)

/** @var \Jihel\Plugin\MailXpertiseBundle\Proxy\ApiProxy $MailXpertiseProxy */
$MailXpertiseProxy = $this->get('jihel.plugin.mail_xpertise.proxy.api');
$client = $MailXpertiseProxy->getClient();
$response = $client->get('/api/lists/info');

4- Thanks

Thanks to me for giving my free time doing class for lazy developers. You can access my CV here, (*13)

The Versions

20/03 2017

dev-master

9999999-dev

A symfony bundle to handle mailxpertise api

  Sources   Download

MIT

The Requires

 

by Joseph Lemoine