PHPackages                             mailerlite/mailerlite-api-v2-php-sdk - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Mail &amp; Notifications](/categories/mail)
4. /
5. mailerlite/mailerlite-api-v2-php-sdk

ActiveLibrary[Mail &amp; Notifications](/categories/mail)

mailerlite/mailerlite-api-v2-php-sdk
====================================

MailerLite API v2 PHP SDK

0.3.2(4y ago)801.7M—5.4%44[3 PRs](https://github.com/mailerlite/mailerlite-api-v2-php-sdk/pulls)12MITPHPPHP ^7.1 || ^8.0

Since May 16Pushed 1y ago11 watchersCompare

[ Source](https://github.com/mailerlite/mailerlite-api-v2-php-sdk)[ Packagist](https://packagist.org/packages/mailerlite/mailerlite-api-v2-php-sdk)[ Docs](https://github.com/mailerlite/mailerlite-api-v2-php-sdk)[ RSS](/packages/mailerlite-mailerlite-api-v2-php-sdk/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (5)Versions (23)Used By (12)

MailerLite Classic API v2 PHP SDK
=================================

[](#mailerlite-classic-api-v2-php-sdk)

**This library is for MailerLite Classic. If you want to integrate with MailerLite please use  instead.**

It is an official PHP SDK for the MailerLite Classic API.

You can find more examples and information about the MailerLite Classic API here:

Getting started
---------------

[](#getting-started)

In order to use this library you need to have at least PHP 7.1 version.

There are two ways to use MailerLite PHP SDK:

##### Use [Composer](https://getcomposer.org/)

[](#use-composer)

If you are not familiar with Composer, learn about it [here](https://getcomposer.org/doc/01-basic-usage.md).

Then you will need to run this simple command using CLI:

```
composer require mailerlite/mailerlite-api-v2-php-sdk

```

This library is built atop of [PSR-7](https://www.php-fig.org/psr/psr-7/) and [PSR-18](https://www.php-fig.org/psr/psr-18/). If you are receiving `Http\Discovery\Exception\DiscoveryFailedException` exception, you will need to run:

```
composer require php-http/guzzle6-adapter
```

##### Manual (preferable for shared hostings)

[](#manual-preferable-for-shared-hostings)

This way is preferable only if you are using shared hosting and do not have a possibility to use Composer. You will need to download the source of the latest release from [here](https://github.com/mailerlite/mailerlite-api-v2-php-sdk/releases), extract it and place its contents in the root folder of your project. The next step is the same as using Composer, you will need to require `vendor/autoload.php` file in your index.php and lets dive in!

Usage examples
--------------

[](#usage-examples)

#### Groups API

[](#groups-api)

In the given example you will see how to initiate selected API and a few actions which are available:

- Create group
- Get groups
- Update group
- Get subscribers who belongs to selected group

```
$groupsApi = (new \MailerLiteApi\MailerLite('your-api-key'))->groups();

$newGroup = $groupsApi->create(['name' => 'New group']); // creates group and returns it

$allGroups = $groupsApi->get(); // returns array of groups

$groupId = 123;
$singleGroup = $groupsApi->find($groupId); // returns single item object

$subscribers = $groupsApi->getSubscribers($groupId); // get subscribers who belongs to selected group

$subscribers = $groupsApi->getSubscribers($groupId, 'unsubscribed'); // get unsubscribed subscribers who belongs to selected group
```

#### Use multiple APIs at once

[](#use-multiple-apis-at-once)

Also `MailerLiteApi\\MailerLite' object can be initiated before selecting API you want to use and it allows to achieve more.

```
$mailerliteClient = new \MailerLiteApi\MailerLite('your-api-key');

$groupsApi = $mailerliteClient->groups();
$groups = $groupsApi->get(); // returns array of groups

$fieldsApi = $mailerliteClient->fields();
$fields = $fieldsApi->get(); // returns array of fields
```

Use your preferred HTTP client
------------------------------

[](#use-your-preferred-http-client)

MailerLite SDK uses cURL as default HTTP client but it is easy to use your preferred client. It is achieved by using [HTTPlug](https://httplug.io) which is PSR-7 compliant HTTP client abstraction.

Here is an example how to use [Guzzle](https://docs.guzzlephp.org/) instead of cURL:

```
$guzzle = new \GuzzleHttp\Client();
$guzzleClient = new \Http\Adapter\Guzzle6\Client($guzzle);

$mailerliteClient = new \MailerLiteApi\MailerLite('your-api-key', $guzzleClient);
```

Support and Feedback
--------------------

[](#support-and-feedback)

In case you find any bugs, submit an issue directly here in GitHub.

You are welcome to create SDK for any other programming language.

If you have any troubles using our API or SDK free to contact our support by email [info@mailerlite.com](mailto:info@mailerlite)

Official documentation is at

###  Health Score

51

—

FairBetter than 96% of packages

Maintenance33

Infrequent updates — may be unmaintained

Popularity56

Moderate usage in the ecosystem

Community35

Small or concentrated contributor base

Maturity68

Established project with proven stability

 Bus Factor3

3 contributors hold 50%+ of commits

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~112 days

Recently: every ~342 days

Total

18

Last Release

1742d ago

PHP version history (4 changes)0.1.0PHP ^5.4|^7.0

0.1.3PHP ^5.5|^7.0

0.3.0PHP ^7.1

0.3.2PHP ^7.1 || ^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/6f40e782a8e6ee52ee612002cb2d97a56c298f5b166e249adea21bcd731fdd27?d=identicon)[mailerlite](/maintainers/mailerlite)

---

Top Contributors

[![npetrunova](https://avatars.githubusercontent.com/u/11510615?v=4)](https://github.com/npetrunova "npetrunova (18 commits)")[![DomasWEB](https://avatars.githubusercontent.com/u/11888315?v=4)](https://github.com/DomasWEB "DomasWEB (10 commits)")[![dominykasmailer](https://avatars.githubusercontent.com/u/45770777?v=4)](https://github.com/dominykasmailer "dominykasmailer (10 commits)")[![johnkelesidis](https://avatars.githubusercontent.com/u/72185528?v=4)](https://github.com/johnkelesidis "johnkelesidis (9 commits)")[![tadaspaplauskas](https://avatars.githubusercontent.com/u/5982246?v=4)](https://github.com/tadaspaplauskas "tadaspaplauskas (6 commits)")[![CobraSphere-IB](https://avatars.githubusercontent.com/u/10376296?v=4)](https://github.com/CobraSphere-IB "CobraSphere-IB (5 commits)")[![JuliusB](https://avatars.githubusercontent.com/u/9655075?v=4)](https://github.com/JuliusB "JuliusB (2 commits)")[![flowdee](https://avatars.githubusercontent.com/u/2278756?v=4)](https://github.com/flowdee "flowdee (2 commits)")[![witold-prucnel](https://avatars.githubusercontent.com/u/7393285?v=4)](https://github.com/witold-prucnel "witold-prucnel (2 commits)")[![karlkeefer](https://avatars.githubusercontent.com/u/305272?v=4)](https://github.com/karlkeefer "karlkeefer (1 commits)")[![jissereitsma](https://avatars.githubusercontent.com/u/7670482?v=4)](https://github.com/jissereitsma "jissereitsma (1 commits)")

---

Tags

emailemail-campaignsemail-marketingmailerlitemailerlite-apimarketing-automationmarketing-emailsphpphp-sdksdkemailmarketingmailerlite

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/mailerlite-mailerlite-api-v2-php-sdk/health.svg)

```
[![Health](https://phpackages.com/badges/mailerlite-mailerlite-api-v2-php-sdk/health.svg)](https://phpackages.com/packages/mailerlite-mailerlite-api-v2-php-sdk)
```

###  Alternatives

[mailerlite/mailerlite-php

MailerLite PHP SDK

31423.6k3](/packages/mailerlite-mailerlite-php)[railsware/mailtrap-php

The Mailtrap SDK provides methods for all API functions.

56770.5k](/packages/railsware-mailtrap-php)[princealikhan/laravel-mautic-api

Free and Open Source Marketing Automation API

415.9k](/packages/princealikhan-laravel-mautic-api)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
