PHPackages                             melvin-hamilton-digital/emarsys-api - 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. melvin-hamilton-digital/emarsys-api

ActiveLibrary

melvin-hamilton-digital/emarsys-api
===================================

Emarsys API integration

0.1.1(4y ago)02MITPHPPHP &gt;=7.2

Since Aug 12Pushed 4y ago1 watchersCompare

[ Source](https://github.com/melvin-hamilton-digital/emarsys-api)[ Packagist](https://packagist.org/packages/melvin-hamilton-digital/emarsys-api)[ RSS](/packages/melvin-hamilton-digital-emarsys-api/feed)WikiDiscussions main Synced today

READMEChangelog (2)Dependencies (5)Versions (3)Used By (0)

Emarsys API
===========

[](#emarsys-api)

[![build](https://camo.githubusercontent.com/305a3ea6b6a91a61a94ddaf20ef9edd71da1c160cb802b5378ce1e7aa67186fc/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f6d656c76696e2d68616d696c746f6e2d6469676974616c2f656d61727379732d6170692f504850253230436f6d706f736572)](https://github.com/melvin-hamilton-digital/emarsys-api/actions)

API documentation
-----------------

[](#api-documentation)

Current features
----------------

[](#current-features)

- contact management,
- triggering external events,
- fields management,
- product and sales feed generation,
- sales feed upload.

Example usage
-------------

[](#example-usage)

```
use GuzzleHttp\Client as HttpClient;
use MHD\Emarsys\Api\Authentication;
use MHD\Emarsys\Api\Client as EmarsysClient;
use MHD\Emarsys\Api\Contacts;
use MHD\Emarsys\Api\Events;
use MHD\Emarsys\Data\ContactFields;

$authentication = new Authentication('username', 'secret');
$httpClient = new HttpClient(['base_uri' => EmarsysClient::BASE_URI]);
$emarsysClient = new EmarsysClient($authentication, $httpClient);

# create new contact
$newContact = (new ContactFields())
    ->setEmail('john.doe@example.org')
    ->setFirstName('John')
    ->setLastName('Doe')
    ->setGender(ContactFields::GENDER_MALE);

$contacts = new Contacts($emarsysClient);
$contacts->createContact($newContact);

# send email to John
$events = new Events($emarsysClient);
$events->triggerEvent(1234, 'john.doe@example.org');
```

Product feed
------------

[](#product-feed)

Emarsys product feed can be either Google Product Feed or custom CSV format. While using Google Product Feed might be a better idea, since it is supported not only by Emarsys, this library still provides:

- [`MHD\Emarsys\Data\ProductData`](./src/Data/ProductData.php) class, which covers all standard product data fields,
- [`MHD\Emarsys\ProductFeed\CustomField`](./src/ProductFeed/CustomField.php) annotation class and [`MHD\Emarsys\ProductFeed\ProductDataNameConverter`](./src/ProductFeed/ProductDataNameConverter.php)for custom product data fields,

Those classes are meant to be used with `symfony/serializer` library.

```
use MHD\Emarsys\Data\ProductData;
use MHD\Emarsys\ProductFeed\ProductDataNameConverter;
use Symfony\Component\Serializer\Encoder\CsvEncoder;
use Symfony\Component\Serializer\Normalizer\DateTimeNormalizer;
use Symfony\Component\Serializer\Normalizer\PropertyNormalizer;
use Symfony\Component\Serializer\Serializer;

class CustomProductData extends ProductData
{
    /**
     * @MHD\Emarsys\ProductFeed\CustomField
     */
    public $customField;
}

$productData = new CustomProductData;
$productData->item = 'foo';
$productData->customField = 'bar';

$normalizers = [
    new PropertyNormalizer(null, new ProductDataNameConverter()),
    new DateTimeNormalizer(),
];
$serializer = new Serializer($normalizers, [new CsvEncoder()]);

echo $serializer->serialize([$productData], 'csv');

# c_custom_field,item,title,link,image,zoom_image,category,available,description,price,msrp,brand
# bar,foo,,,,,,,,,,
```

Sales feed
----------

[](#sales-feed)

For Emarsys sales feed generation this library provides:

- [`MHD\Emarsys\Data\SalesData`](./src/Data/SalesData.php) class, which covers standard sales data field set,
- [`MHD\Emarsys\SalesFeed\CustomField`](./src/SalesFeed/CustomField.php) annotation class, and [`MHD\Emarsys\SalesFeed\SalesDataNameConverter`](./src/SalesFeed/SalesDataNameConverter.php) for sales data custom fields,
- [`MHD\Emarsys\SalesFeed\Uploader`](./src/SalesFeed/Uploader.php) class for automated sales feed upload.

```
use MHD\Emarsys\Data\SalesData;
use MHD\Emarsys\SalesFeed\SalesDataNameConverter;
use Symfony\Component\Serializer\Encoder\CsvEncoder;
use Symfony\Component\Serializer\Normalizer\DateTimeNormalizer;
use Symfony\Component\Serializer\Normalizer\PropertyNormalizer;
use Symfony\Component\Serializer\Serializer;

class CustomSalesData extends SalesData
{
    /**
     * @MHD\Emarsys\SalesFeed\CustomField("string")
     */
    public $customField;
}

$salesData = new CustomSalesData;
$salesData->item = 'foo';
$salesData->customField = 'bar';

$normalizers = [
    new PropertyNormalizer(null, new SalesDataNameConverter()),
    new DateTimeNormalizer(),
];
$serializer = new Serializer($normalizers, [new CsvEncoder()]);

echo $serializer->serialize([$salesData], 'csv');

# s_custom_field,item,price,order,timestamp,customer,email,quantity
# bar,foo,,,,,,
```

###  Health Score

18

—

LowBetter than 8% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity2

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity37

Early-stage or recently created project

 Bus Factor1

Top contributor holds 66.7% 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 ~1 days

Total

2

Last Release

1732d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/11462938?v=4)[wiatrogon](/maintainers/wiatrogon)[@Wiatrogon](https://github.com/Wiatrogon)

![](https://avatars.githubusercontent.com/u/4592934?v=4)[Jan Myszkier](/maintainers/janmyszkier)[@janmyszkier](https://github.com/janmyszkier)

---

Top Contributors

[![Wiatrogon](https://avatars.githubusercontent.com/u/11462938?v=4)](https://github.com/Wiatrogon "Wiatrogon (2 commits)")[![janmyszkier](https://avatars.githubusercontent.com/u/4592934?v=4)](https://github.com/janmyszkier "janmyszkier (1 commits)")

---

Tags

emarsys

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/melvin-hamilton-digital-emarsys-api/health.svg)

```
[![Health](https://phpackages.com/badges/melvin-hamilton-digital-emarsys-api/health.svg)](https://phpackages.com/packages/melvin-hamilton-digital-emarsys-api)
```

###  Alternatives

[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.4k5.6M651](/packages/sylius-sylius)[kreait/firebase-php

Firebase Admin SDK

2.4k39.7M72](/packages/kreait-firebase-php)[shopware/platform

The Shopware e-commerce core

3.3k1.5M3](/packages/shopware-platform)[drupal/core-recommended

Locked core dependencies; require this project INSTEAD OF drupal/core.

6939.5M343](/packages/drupal-core-recommended)[googleads/googleads-php-lib

Google Ad Manager SOAP API Client Library for PHP

67410.3M25](/packages/googleads-googleads-php-lib)[drupal/core

Drupal is an open source content management platform powering millions of websites and applications.

19462.3M1.3k](/packages/drupal-core)

PHPackages © 2026

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