ideneal / emailoctopus
EmailOctopus Service Client Library
Installs: 4 528
Dependents: 0
Suggesters: 0
Security: 0
Stars: 4
Watchers: 4
Forks: 5
Open Issues: 1
Requires
- php: >=7.4
- ext-json: *
- guzzlehttp/guzzle: ^7.0
Requires (Dev)
- phpunit/phpunit: ^7
README
A PHP wrapper for EmailOctopus email marketing service.
For more information on how to set up your account, read the API docs.
Installation
To add the library in your project just type the following:
composer require ideneal/emailoctopus
Usage
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.
Create new list
use Ideneal\EmailOctopus\Entity\MailingList; $list = new MailingList(); $list->setName('My cool list'); $emailOctopus->createMailingList($list);
Add a contact to the previous list
use Ideneal\EmailOctopus\Entity\Contact; $contact = new Contact(); $contact ->setEmail('john.doe@mail.com') ->setFirstName('John') ->setLastName('Doe') ; $emailOctopus->createContact($contact, $list);
Retrieve all contacts from the previous list
$emailOctopus->getContactsByMailingList($list);
Remove contact from the previous list
$contact = $emailOctopus->getContactByMailingList('CONTACT-ID', $list); $emailOctopus->deleteContact($contact, $list);
License
The repository is available as open source under the terms of the MIT License.