Skip to content
This repository was archived by the owner on Jan 21, 2023. It is now read-only.

Commit 58d5bc0

Browse files
committed
updated readme
1 parent 5386ec5 commit 58d5bc0

File tree

4 files changed

+40
-6
lines changed

4 files changed

+40
-6
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
# Created by .ignore support plugin (hsz.mobi)
1+
vendor
2+
composer.lock

README.md

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,35 @@
1-
# mailchimp-api
1+
# Devlib/MailChimp-API
2+
23
Simple MailChimp API Wrapper
4+
5+
### Install
6+
`composer require devlib/mailchimp-api`
7+
8+
### Usage
9+
```php
10+
use DevLib\API\MailChimp\MailChimp;
11+
12+
$apiKey = getenv('MC_API_KEY');
13+
$list_id = getenv('MC_LIST_ID');
14+
15+
$api = new MailChimp($apiKey, $list_id);
16+
```
17+
18+
### Subscribe user
19+
```php
20+
use DevLib\API\MailChimp\MailChimp;
21+
use MailChimpAPIException
22+
23+
$email = 'you@example.com';
24+
25+
try{
26+
27+
$api->subscribe($email, [
28+
'FNAME' => 'Emma',
29+
'LNAME' => 'Doe'
30+
]);
31+
32+
}catch(MailChimp\MailChimpAPIException $e){
33+
echo ( 'Error: ' . $e->getMessage() );
34+
}
35+
```

src/API/MailChimp/MailChimp.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<?php
22
/**
3-
* SMS Signin Gateway - Mailchimp API integration class
4-
* @author adrian7 (adrian@studentmoneysaver.co.uk)
5-
* @version 1.1
3+
* MailChimp API Wrapper Main Class
4+
* @author adrian7
5+
* @version 1.0
66
*/
77

88
namespace DevLib\API\MailChimp;

tests/unit/MailChimpTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ protected function _before() {
6161
$this->fail("Please provide the MAILCHIMP_LIST_ID env variable ... . ");
6262

6363
//init wrapper
64-
$this->wrapper = new \DevLib\API\MailChimp( $apiKey, $this->list_id );
64+
$this->wrapper = new DevLib\API\MailChimp\MailChimp( $apiKey, $this->list_id );
6565

6666
}
6767

0 commit comments

Comments
 (0)