PHPackages                             mailcampaigns/api-client - 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. mailcampaigns/api-client

ActiveLibrary

mailcampaigns/api-client
========================

MailCampaigns API client

2.2.0(1y ago)01.3k[1 PRs](https://github.com/mailcampaigns/php-api-client/pulls)proprietaryPHPPHP ^8.2

Since Jul 6Pushed 1y ago3 watchersCompare

[ Source](https://github.com/mailcampaigns/php-api-client)[ Packagist](https://packagist.org/packages/mailcampaigns/api-client)[ Docs](https://api-v3.mailcampaigns.nl/)[ RSS](/packages/mailcampaigns-api-client/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (2)Versions (42)Used By (0)

[![MailCampaigns](https://camo.githubusercontent.com/eb546aea227a8855aa0cbc47c6d2e062750baf8dbdb957eaa2ea6f7498742e8c/68747470733a2f2f7777772e6d61696c63616d706169676e732e6e6c2f696d616765732f6c6f676f2e737667)](https://camo.githubusercontent.com/eb546aea227a8855aa0cbc47c6d2e062750baf8dbdb957eaa2ea6f7498742e8c/68747470733a2f2f7777772e6d61696c63616d706169676e732e6e6c2f696d616765732f6c6f676f2e737667)

[![Packagist PHP Version Support](https://camo.githubusercontent.com/561aecae0c7d2f3dad975009b975cebf25d36ef0f761476dfd3c165a8807c128/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f6d61696c63616d706169676e732f6170692d636c69656e74)](https://camo.githubusercontent.com/561aecae0c7d2f3dad975009b975cebf25d36ef0f761476dfd3c165a8807c128/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f6d61696c63616d706169676e732f6170692d636c69656e74)[![GitHub](https://camo.githubusercontent.com/07d5c2238b01df2d49dcbbdeab850e4621ea49bdc5c6cf8c2e16e04ddd803313/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f6d61696c63616d706169676e732f7068702d6170692d636c69656e74)](https://camo.githubusercontent.com/07d5c2238b01df2d49dcbbdeab850e4621ea49bdc5c6cf8c2e16e04ddd803313/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f6d61696c63616d706169676e732f7068702d6170692d636c69656e74)

MailCampaigns PHP API client
============================

[](#mailcampaigns-php-api-client)

The MailCampaigns PHP Api client provides an easy way to communicate with the MailCampaigns RESTful API (v3).

Installation
------------

[](#installation)

Install with Composer:

```
composer require mailcampaigns/api-client
```

Usage
-----

[](#usage)

You'll need the Api url, client key and secret which can be obtained by logging in to your MailCampaigns account (on the Custom Connector page).

*Note: This section will be updated soon!*

```
use MailCampaigns\ApiClient\ApiClient;
use MailCampaigns\ApiClient\Entity\Customer;

$apiClient = ApiClient::create('', '', '');
$customerApi = $apiClient->getCustomerApi();

// Example 1 - Retrieve a customer by id:
$customer = $customerApi->getById(1234);

// Example 2 - Retrieve first three pages of customers:
for ($page = 1; $page getCollection($page);

    /** @var Customer $customer */
    foreach ($customers as $customer) {
        // Use customer as an entity (object):
        print $customer->getEmail() . PHP_EOL;

        // Output customer as an array.
        print_r($customer->toArray());
    }
}

// Example 3 - Create a new customer:
$customerApi->create(
    (new Customer)
        ->setCustomerRef('CUST-8539')
        ->setEmail('johndoe@hotmail.com')
        ->setFirstName('John')
        ->setLastName('Doe')
        ->setGender('male')
);

// Example 4 - Update a customer:
$customerApi->update($customer);

// Example 5 - Get customer by customer reference:
$customer = $customerApi->getByCustomerRef('CUST-8539');

// Example 6 - Get customer by email address:
$customer = $customerApi->getByEmail('bob@hotmail.com');

// Example 7 - Delete a customer by id.
$customerApi->deleteById(1234);
```

Using custom fields:

```
use MailCampaigns\ApiClient\ApiClient;
use MailCampaigns\ApiClient\Entity\Customer;
use MailCampaigns\ApiClient\Entity\CustomerCustomField;

$apiClient = ApiClient::create('', '', '');

$customerCustomFieldApi = $apiClient->getCustomerCustomFieldApi();

// Example 1: Add a new custom field to an existing customer.
$customer = (new Customer)->setCustomerId(6); // Or load an actual customer first.

$customField = (new CustomerCustomField)
    ->setName('een_extra_veld_2')
    ->setValue('Waarde voor extra veld 2.')
    ->setCustomer($customer);

$createdCustomField = $customerCustomFieldApi->create($customField);

// The created custom field will contain the generated id.
print $createdCustomField->getCustomFieldId();

// Example 2: Update an existing custom field.
$customField
    ->setUpdatedAt(new DateTime())
    ->setValue('Een aangepaste waarde.');

$updatedCustomField = $customerCustomFieldApi->update($customField);

// Example 4: Delete a custom field by its id.
$customerCustomFieldApi->deleteById(123);
```

Resources
---------

[](#resources)

- [API v3 Documentation](https://api-v3.mailcampaigns.nl)
- [GitHub](https://github.com/mailcampaigns/php-api-client)

###  Health Score

41

—

FairBetter than 89% of packages

Maintenance43

Moderate activity, may be stable

Popularity16

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity80

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 74.2% of commits — single point of failure

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 ~42 days

Recently: every ~163 days

Total

41

Last Release

449d ago

Major Versions

0.0.1 → 1.0.02020-08-03

1.12.2 → 2.0.02023-07-26

2.2.0 → 3.0.0.x-dev2025-02-14

PHP version history (3 changes)0.0.1PHP ^7.1

2.0.0PHP ^8.2

3.0.0.x-devPHP ^8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/68bd67c5485f7a1066394ea1420a5bb1f9b015d7927bd6ec67936448d0c4beec?d=identicon)[graftak](/maintainers/graftak)

---

Top Contributors

[![graftak](https://avatars.githubusercontent.com/u/30551282?v=4)](https://github.com/graftak "graftak (49 commits)")[![w-steenkist](https://avatars.githubusercontent.com/u/213772198?v=4)](https://github.com/w-steenkist "w-steenkist (11 commits)")[![twanhaverkamp](https://avatars.githubusercontent.com/u/38506134?v=4)](https://github.com/twanhaverkamp "twanhaverkamp (6 commits)")

###  Code Quality

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/mailcampaigns-api-client/health.svg)

```
[![Health](https://phpackages.com/badges/mailcampaigns-api-client/health.svg)](https://phpackages.com/packages/mailcampaigns-api-client)
```

###  Alternatives

[temporal/sdk

Temporal SDK

4002.2M18](/packages/temporal-sdk)[web-auth/webauthn-framework

FIDO2/Webauthn library for PHP and Symfony Bundle.

50570.7k1](/packages/web-auth-webauthn-framework)[internal/dload

Downloads binaries.

98142.7k10](/packages/internal-dload)[acquia/orca

A tool for testing a company's software packages together in the context of a realistic, functioning, best practices Drupal build

32902.4k](/packages/acquia-orca)[mahocommerce/maho

Free and open source ecommerce platform, created in 2024 on the M1 platform, PHP 8.3+

1322.1k12](/packages/mahocommerce-maho)

PHPackages © 2026

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