Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/cooptilleuls/cooptilleulsymlpbundle
Integrates YMLP API for Symfony
https://github.com/cooptilleuls/cooptilleulsymlpbundle
api guzzle newsletter php symfony symfony-bundle symfony2 symfony3 ymlp ymlp-api
Last synced: 3 months ago
JSON representation
Integrates YMLP API for Symfony
- Host: GitHub
- URL: https://github.com/cooptilleuls/cooptilleulsymlpbundle
- Owner: coopTilleuls
- License: mit
- Created: 2013-11-28T13:24:16.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2017-03-14T11:02:53.000Z (almost 8 years ago)
- Last Synced: 2024-10-13T06:04:24.622Z (3 months ago)
- Topics: api, guzzle, newsletter, php, symfony, symfony-bundle, symfony2, symfony3, ymlp, ymlp-api
- Language: PHP
- Homepage: http://les-tilleuls.coop
- Size: 22.5 KB
- Stars: 4
- Watchers: 24
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# CoopTilleulsYmlpBundle, YMLP API for Symfony
This bundle integrates the [Your Mailing List Provider (YMLP)](http://www.ymlp.com/) API into [Symfony](http://symfony.com) projects.
[![Latest Stable Version](https://poser.pugx.org/tilleuls/ymlp-bundle/v/stable.svg)](https://packagist.org/packages/tilleuls/ymlp-bundle) [![Build Status](https://travis-ci.org/coopTilleuls/CoopTilleulsYmlpBundle.svg)](https://travis-ci.org/coopTilleuls/CoopTilleulsYmlpBundle) [![SensioLabsInsight](https://insight.sensiolabs.com/projects/5be76419-0b77-4283-82c9-7333dcf43595/mini.png)](https://insight.sensiolabs.com/projects/5be76419-0b77-4283-82c9-7333dcf43595)
## Installation
Use [Composer](http://getcomposer.org/) to install this bundle:
composer require tilleuls/ymlp-bundle
Add the bundle in your application kernel:
```php
// app/AppKernel.phppublic function registerBundles()
{
return [
// ...
new CoopTilleuls\Bundle\YmlpBundle\CoopTilleulsYmlpBundle(),
// ...
];
}
```## Configuration
```yaml
# app/config/config.ymlcoop_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
-----```php
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](http://www.ymlp.com/app/api.php) (require YMLP credentials).
## Credits
This bundle has been written by Baptiste Meyer for [Les-Tilleuls.coop](http://les-tilleuls.coop).