dev-master
9999999-devA symfony bundle to handle mailxpertise api
MIT
The Requires
- php >=5.4
- symfony/symfony >=2.1
- guzzlehttp/guzzle >=6.2
by Joseph Lemoine
A symfony bundle to handle 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)
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(), ); }
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
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');
Thanks to me for giving my free time doing class for lazy developers. You can access my CV here, (*13)
A symfony bundle to handle mailxpertise api
MIT