PHPackages                             barnebys/mautic-api-helper - 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. [API Development](/categories/api)
4. /
5. barnebys/mautic-api-helper

AbandonedArchivedLibrary[API Development](/categories/api)

barnebys/mautic-api-helper
==========================

V0.4.0(8y ago)2737MITPHPPHP &gt;=5.5

Since Jan 16Pushed 8y ago2 watchersCompare

[ Source](https://github.com/barnebys/mautic-api-helper)[ Packagist](https://packagist.org/packages/barnebys/mautic-api-helper)[ RSS](/packages/barnebys-mautic-api-helper/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (6)Dependencies (2)Versions (7)Used By (0)

### Mautic API Helper

[](#mautic-api-helper)

Requires the [Mautic Simple Mail](https://github.com/barnebys/MauticSimpleEmailBundle) plugin to be installed.

#### With basic auth

[](#with-basic-auth)

```
BarnebysMautic\Auth::initializeHttpBasic('username', 'password');
BarnebysMautic\Api::setBaseUrl('https://my.mautic.domain/api');

```

### With oauth

[](#with-oauth)

```
BarnebysMautic\Auth::initializeOAuth2

```

### Fetch a contact id by email

[](#fetch-a-contact-id-by-email)

```
try {
    $data = BarnebysMautic\Api::getContactIdByMail('some@email.com');
} catch (BarnebysMautic\Exception\ContactNotFoundException $exception) {
    // Handle error
}

```

### Handling Contacts

[](#handling-contacts)

##### Creating a contact

[](#creating-a-contact)

```
BarnebysMautic\Api::createContact($email, array $fields = [);

```

##### Updating a contact

[](#updating-a-contact)

Updating a contact will do a PATCH and only update specified fields in the array.

```
BarnebysMautic\Api::updateContact($email, array $fields = [);

```

### Sending emails

[](#sending-emails)

When sending emails you can with ease use `sendToContact` and just set the email and a templateId. If you need to pass on some custom fields to be used in Mautic those can set as a key =&gt; value array for parameter 3. When sending values contain HTML and to disable Mautic HTML escaper set the 4th parameter to true.

##### Sending a email with custom fields

[](#sending-a-email-with-custom-fields)

```
$tokens = [
    'custom_content' => 'This will value will be available in mautic as {custom_content}'
];

sendToContact($mail, $templateId, $tokens)

```

##### Sending a email with html content

[](#sending-a-email-with-html-content)

```
$tokens = [
    'html_content' => 'This html content will not be escpaed'
];

sendToContact($mail, $templateId, $tokens, true)

```

### Other available methods

[](#other-available-methods)

```
getContactIdByMail($mail)
sendToLead($mail, $templateId, array $tokens = [], $html = false)
sendToContact($mail, $templateId, array $tokens = [], $html = false)

```

###  Health Score

29

—

LowBetter than 60% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity62

Established project with proven stability

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

Total

6

Last Release

2976d ago

PHP version history (2 changes)v0.0.1PHP &gt;=5.6

V0.4.0PHP &gt;=5.5

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/26894649?v=4)[Barnebys Group AB](/maintainers/barnebys)[@barnebys](https://github.com/barnebys)

### Embed Badge

![Health badge](/badges/barnebys-mautic-api-helper/health.svg)

```
[![Health](https://phpackages.com/badges/barnebys-mautic-api-helper/health.svg)](https://phpackages.com/packages/barnebys-mautic-api-helper)
```

###  Alternatives

[sylius/sylius

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

8.4k5.6M647](/packages/sylius-sylius)[algolia/algoliasearch-client-php

API powering the features of Algolia.

69333.0M113](/packages/algolia-algoliasearch-client-php)[theodo-group/llphant

LLPhant is a library to help you build Generative AI applications.

1.5k311.5k5](/packages/theodo-group-llphant)[wheelpros/fitment-platform-api

Magento 2 (Open Source)

12.1k1.2k](/packages/wheelpros-fitment-platform-api)[alexacrm/dynamics-webapi-toolkit

Web API toolkit for Microsoft Dynamics 365 and Dynamics CRM

81324.1k1](/packages/alexacrm-dynamics-webapi-toolkit)[comgate/sdk

Comgate PHP SDK

13327.8k](/packages/comgate-sdk)

PHPackages © 2026

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