Skip to content

Commit

Permalink
Initial Commit
Browse files Browse the repository at this point in the history
  • Loading branch information
hugofirth committed Aug 9, 2013
0 parents commit 679a1a5
Show file tree
Hide file tree
Showing 10 changed files with 2,687 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/vendor
composer.phar
composer.lock
.DS_Store
12 changes: 12 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
language: php

php:
- 5.3
- 5.4
- 5.5

before_script:
- curl -s http://getcomposer.org/installer | php
- php composer.phar install --dev

script: phpunit
61 changes: 61 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
Mailchimp API w. support for Laravel
---

This package acts as an alternative mirror for the PHP class, for use with the MailChimp API, provided by MailChimp® [Here][1].

The package supports use with the [Laravel framework][2] (v4) providing a `Mailchimp` facade.

----

###Setup:

In order to install add the following to your `composer.json` file within the `require` block:

"require": {
"hugofirth/mailchimp": "dev-master",
}

Within Laravel, locate the file `..app/config/app.php` *.

Add the following to the `providers` array:

'providers' => array(
'Hugofirth\Mailchimp\MailchimpServiceProvider',
),

Furthermore, add the following the the `aliases` array:

'aliases' => array(
'Mailchimp' => 'Hugofirth\Mailchimp\Facades\Mailchimp',
),

Lastly, run the command `composer update`.

_\* The subsequent steps should be repeated for any file `app.php` created for additional environments._

----

###Usage:

Your unique MailChimp API key should be set in the package's config found in `..vendor/hugofirth/mailchimp/src/config/config.php`

Methods of the MailChimp api class work as described by the MailChimp API docs found [Here][3]. Thanks to Laravel's use of the "Facade" design pattern, all methods may be called in the following manner:

//Retrieve an array of lists for your account
$lists = Mailchimp::lists();
//Subscribe a user, with email: $email_address, to a list with id: $list_id
Mailchimp::listSubscribe($list_id, $email_address);

Enjoy!

[1]: http://apidocs.mailchimp.com/api/downloads/#php
[2]: http://laravel.com/
[3]: http://apidocs.mailchimp.com/api/1.3/
21 changes: 21 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"name": "hugofirth/mailchimp",
"description": "Wrapper on the MCAPI class provided by Mailchimp - with support for Laravel 4",
"keywords": ["laravel", "mailchimp"],
"authors": [
{
"name": "Hugo Firth",
"email": "hebfirth@gmail.com"
}
],
"require": {
"php": ">=5.3.0",
"illuminate/support": "4.0.x"
},
"autoload": {
"psr-0": {
"Hugofirth\\Mailchimp": "src/"
}
},
"minimum-stability": "dev"
}
18 changes: 18 additions & 0 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
backupStaticAttributes="false"
bootstrap="vendor/autoload.php"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
syntaxCheck="false"
>
<testsuites>
<testsuite name="Package Test Suite">
<directory suffix=".php">./tests/</directory>
</testsuite>
</testsuites>
</phpunit>
13 changes: 13 additions & 0 deletions src/Hugofirth/Mailchimp/Facades/Mailchimp.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

namespace HugoFirth\Mailchimp\Facades;

use Illuminate\Support\Facades\Facade;

class Mailchimp extends Facade
{
protected static function getFacadeAccessor()
{
return 'mailchimp';
}
}
Loading

0 comments on commit 679a1a5

Please # to comment.