A PHP wrapper for EmailOctopus email marketing service.
For more information on how to set up your account, read the API docs.
To add the library in your project just type the following:
composer require ideneal/emailoctopus
First you need to retrieve the API key as explained in API docs. After that you could initialize the wrapper by adding the following code:
use Ideneal\EmailOctopus\EmailOctopus;
$emailOctopus = new EmailOctopus('YOUR-API-KEY');
Now you can perform the CRUD operations the API provides using the $emailOctopus
instance.
use Ideneal\EmailOctopus\Entity\MailingList;
$list = new MailingList();
$list->setName('My cool list');
$emailOctopus->createMailingList($list);
use Ideneal\EmailOctopus\Entity\Contact;
$contact = new Contact();
$contact
->setEmail('john.doe@mail.com')
->setFirstName('John')
->setLastName('Doe')
;
$emailOctopus->createContact($contact, $list);
$emailOctopus->getContactsByMailingList($list);
$contact = $emailOctopus->getContactByMailingList('CONTACT-ID', $list);
$emailOctopus->deleteContact($contact, $list);
The repository is available as open source under the terms of the MIT License.