Skip to content

rubenbuijs/mailcoach-api-wrapper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Mailcoach API Wrapper

This is an API wrapper for Spatie's Mailcoach. Use this package when you have installed Mailcoach on a standalone server - separate from your app. I favored the standalone instance because it reduced dependencies in my apps.

Installation

A prerequisite is that you have installed Mailcoach as a standalone app.

You can install this package via composer:

composer require rubenbuijs/mailcoach-api-wrapper

Configuration

MAILCOACH_API_BASE_URL=https://yourdomain.com/api
MAILCOACH_API_TOKEN=1|XXXXXXXXXXXXXXXXXXXXXXX # Mailcoach installation: Config->API Tokens
MAILCOACH_LIST_ID=1
MAILCOACH_SSL=false

Usage

After installation, the Newsletter class is available to interact with your Mailcoach server.

Subscribe a new person

Newsletter::subscribe(string $email, string $name, array $tags = [])

Update a subscriber

Enter NULL when you don't want to make changes to the email, name, or tags.

Newsletter::update(string $email, string $new_email = null, string $name = null, array $tags = null)

Add tag(s)

Newsletter::addTags(string $email, array $tags_to_add)

Delete tag(s)

Newsletter::deleteTags(string $email, array $tags_to_delete)

Retrieve subscriber data

Newsletter::getSubscriberByEmail(string $email)

Enjoyed this package?

Take a look at my products:

  • Boei: Website Lead, Communication & Social widget
  • ProductLift: World’s most flexible prioritization, roadmap, and changelog tool.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages