An open API service indexing awesome lists of open source software.

https://github.com/casinelli/laravel-campaignmonitor

A Laravel 5 wrapper for CampaignMonitor APIs
https://github.com/casinelli/laravel-campaignmonitor

campaign-monitor laravel

Last synced: 4 months ago
JSON representation

A Laravel 5 wrapper for CampaignMonitor APIs

Awesome Lists containing this project

README

        

# Laravel-CampaignMonitor
A Laravel 5 wrapper for CampaignMonitor APIs

## Installation

- [Laravel-CampaignMonitor on Packagist](https://packagist.org/packages/casinelli/laravel-campaignmonitor)
- [Laravel-CampaignMonitor on GitHub](https://github.com/Casinelli/Laravel-CampaignMonitor)

To get the latest version of Laravel-CampaignMonitor simply require it in your `composer.json` file.

~~~
"casinelli/laravel-campaignmonitor": "dev-master"
~~~

You'll then need to run `composer install` to download it and have the autoloader updated.

Once Laravel-CampaignMonitor is installed you need to register the service provider with the application. Open up `app/config/app.php` and find the `providers` key.

~~~php
[

Casinelli\CampaignMonitor\CampaignMonitorServiceProvider::class,

]
~~~

Laravel-CampaignMonitor also ships with a facade. You can register the facade in the `aliases` key of your `app/config/app.php` file.

~~~php
[

'CampaignMonitor' => Casinelli\CampaignMonitor\Facades\CampaignMonitor::class,

]
~~~

Create the configuration file using artisan

~~~
$ php artisan vendor:publish --provider="Casinelli\CampaignMonitor\CampaignMonitorServiceProvider"
~~~

And set your own API key and Client ID:

~~~php
env('CAMPAIGNMONITOR_API_KEY'),

'client_id' => env('CAMPAIGNMONITOR_CLIENT_ID'),

];
~~~

## Usage

You can find all the methods in the original [campaignmonitor/createsend-php package](https://github.com/campaignmonitor/createsend-php).

Some examples:

~~~php
add([
'EmailAddress' => '[email protected]',
'Name' => 'Giovanni Casinelli',
]);

// Create a list for a Client:
$result = CampaignMonitor::lists()->create(\Config::get('campaignmonitor.client_id'), [
'Title' => 'List name',
]);
~~~

To send classic transactional emails:

~~~php
'[email protected]',
'To' => '[email protected]',
'ReplyTo' => '[email protected]',
'CC' => '[email protected]',
'BCC' => '[email protected]',
'HTML' => '

Hello there!

',
'Text' => 'Hello there!',
];

CampaignMonitor::classicSend('CLIENT_ID')->send($data);
~~~