Download the PHP package spatie/mailcoach-sdk-php without Composer

On this page you can find all versions of the php package spatie/mailcoach-sdk-php. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package mailcoach-sdk-php

An SDK for using the Mailcoach API in PHP

Latest Version on Packagist Tests PHPStan Total Downloads

This package contains the PHP SDK to work with Mailcoach. Both self-hosted (v6 and up) and hosted Mailcoach (aka Mailcoach Cloud) are supported. Using this package you can manage email lists, subscribers and campaigns.

Here are a few examples:

By default, Mailcoach' endpoints will are paginated with a limit of 1000. The package makes it easy to work with paginated resources. Just call ->next() to get the next page.

Support us

We invest a lot of resources into creating best in class open source packages. You can support us by buying one of our paid products.

We highly appreciate you sending us a postcard from your hometown, mentioning which of our package(s) you are using. You'll find our address on our contact page. We publish all received postcards on our virtual postcard wall.

Installation

You can install the package via composer:

You must also install Guzzle

Usage

To get started, you must first new up an instance of Spatie\MailcoachSdk\Mailcoach

You can find both the API key and the Mailcoach API endpoint in the "API Tokens" screen of the Mailcoach settings.

Handling pagination

There are several methods, such as emailLists(), 'subscribers()' and campaigns() to will return paginated results. To get the next page of results just call next() on a result. If there are no more results, that method returns null.

Here's how you display the email addresses of every subscriber on a list

On paginated results, $subscribers in the example above there are also some more convenience methods:

Working with email lists

Here's how to get all email lists:

You can get a single email list:

This is how you can create an email list:

You can get properties of email list:

Take a look at the source code of Spatie\MailcoachSdk\Resources\EmailList to see the list of available properties.

You can update an email list by change one of the properties and calling save().

You can delete an email list by calling delete().

Working with subscribers

To get all subscribers of a list, you can call subscribers() on an email list.

Optionally, you can pass filters to subscribers(). Here how to get all subscribers with a Gmail-address.

Alternatively, you can call subscribers() on $mailcoach

There's also a convenience method to quickly get a subscriber from a list.

Alternatively, you can get a subscriber by its UUID:

This how you can create a subscriber:

You can get properties of a subscriber:

Take a look at the source code of Spatie\MailcoachSdk\Resources\Subscriber to see the list of available properties.

You can update a subscriber by change one of the properties and calling save().

You can confirm, unsubscribe and delete a subscriber by calling these methods.

Working with campaigns

Here's how to get all campaigns.

You can also get a single campaign();

This is how you can create a campaign:

You can get properties of a campaign:

Take a look at the source code of Spatie\MailcoachSdk\Resources\Campaign to see the list of available properties.

You can update a campaign by change one of the properties and calling save().

A test mail will be sent when calling sendTest():

The campaign will be sent to all subscribers of your list, by calling send():

A campaign can be deleted:

Testing

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.


All versions of mailcoach-sdk-php with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package spatie/mailcoach-sdk-php contains the following files

Loading the files please wait ....