PHPackages                             esauti/esauti-php - 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. esauti/esauti-php

ActiveLibrary[API Development](/categories/api)

esauti/esauti-php
=================

Official PHP SDK for eSauti – REST API and Event Injection

1.1.0(1mo ago)00MITPHPPHP ^7.4 || ^8.0

Since Apr 28Pushed 1mo agoCompare

[ Source](https://github.com/esauti/esauti-php)[ Packagist](https://packagist.org/packages/esauti/esauti-php)[ RSS](/packages/esauti-esauti-php/feed)WikiDiscussions master Synced 1w ago

READMEChangelogDependencies (3)Versions (2)Used By (0)

esauti-php
==========

[](#esauti-php)

Official PHP 7.4+ SDK for **eSauti** – covering both the REST API (OpenAPI-backed) and the Event Injection API.

---

Requirements
------------

[](#requirements)

- PHP 7.4 or later
- Composer
- `ext-json`

---

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

[](#installation)

```
composer require esauti/esauti-php
```

---

Quick Start
-----------

[](#quick-start)

### REST API

[](#rest-api)

```
use Esauti\EsautiClient;

$client = new EsautiClient(
    'https://your-mautic-host.com/api',
    ['bearer_token' => 'your-api-token'],
    ['timeout' => 30, 'max_retries' => 3]
);

// List contacts
$result = $client->api->contacts()->list(['limit' => 10]);
echo $result['total'];

// Create a contact
$contact = $client->api->contacts()->create([
    'firstname' => 'Jane',
    'lastname'  => 'Doe',
    'email'     => 'jane@example.com',
]);

// Update a contact
$client->api->contacts()->update($contact['contact']['id'], ['city' => 'Montreal']);
```

### Event Injection

[](#event-injection)

```
use Esauti\EsautiClient;
use Esauti\Events\EventType;

$client = new EsautiClient(
    'https://your-mautic-host.com/api',
    ['bearer_token' => 'your-api-token'],
    ['source' => 'my-app']
);

$client->events->send(EventType::CUSTOMER_CREATED, [
    'occurred_at' => date('c'),
    'source'      => 'my-shop',
    'customer'    => [
        'id'    => 'cus_001',
        'email' => 'user@example.com',
    ],
]);
```

### HMAC Signing

[](#hmac-signing)

```
$client = new EsautiClient(
    'https://your-mautic-host.com/api',
    [
        'bearer_token' => 'your-api-token',
        'hmac_secret'  => 'your-hmac-secret',  // enables HMAC on all event requests
    ]
);
```

---

Constructor Options
-------------------

[](#constructor-options)

```
new EsautiClient(
    string $baseUrl,
    array $auth = [
        'bearer_token' => '...',   // Bearer token
        'hmac_secret'  => '...',   // HMAC signing secret (optional)
    ],
    array $options = [
        'timeout'          => 30,          // Request timeout (seconds)
        'connect_timeout'  => 10,          // Connection timeout (seconds)
        'max_retries'      => 3,           // Retry attempts (408, 429, 5xx, network)
        'debug'            => false,       // Write debug logs to STDERR
        'redact_pii'       => false,       // Redact email/phone in logs
        'events_endpoint'  => '/v1/inbound/event',
        'source'           => 'sdk',       // X-eSauti-Source header
        'logger'           => $myLogger,   // Custom LoggerInterface
        'transport'        => $myTransport, // Custom HttpTransportInterface
    ]
);
```

---

API Resources
-------------

[](#api-resources)

ResourceMethods`contacts()``list`, `get`, `create`, `update`, `replace`, `delete`, `segments`, `campaigns`, `addUtm`, `removeUtm`, `addDnc`, `removeDnc``campaigns()``list`, `get`, `create`, `update`, `replace`, `delete`, `addContact`, `removeContact``assets()``list`, `get`, `create`, `update`, `replace`, `delete``categories()``list`, `get`, `create`, `update`, `replace`, `delete``forms()``list`, `get`, `create`, `update`, `replace`, `delete`, `submissions``notifications()``list`, `get`, `create`, `update`, `replace`, `delete``fields()``listContact`, `getContact`, `createContact`, `updateContact`, `deleteContact`, `listCompany`, `getCompany`, `createCompany`, `updateCompany`, `deleteCompany``pointGroups()``list`, `get`, `create`, `update`, `delete``reports()``list`, `get``sms()``list`, `get`, `create`, `update`, `replace`, `delete`, `sendToContact`---

Event Types
-----------

[](#event-types)

All 225 canonical event types are available as constants in `EventType`:

```
use Esauti\Events\EventType;

EventType::CUSTOMER_CREATED     // 'customer.created'
EventType::ORDER_PAID           // 'order.paid'
EventType::SUBSCRIPTION_CREATED // 'subscription.created'
// ... 225 total
```

---

Dead-Letter Sink
----------------

[](#dead-letter-sink)

Failed event deliveries (after all retries) are written to `./deadletter/events.jsonl`. Override:

```
use Esauti\Events\DeadLetterSink;
use Esauti\Events\EventRegistry;
use Esauti\Events\EventsClient;

$sink = new DeadLetterSink(function (array $envelope, \Throwable $reason) {
    // Send to your own queue, log, alert, etc.
    myErrorTracker()->capture($reason, ['envelope' => $envelope]);
});
```

---

Custom HTTP Transport
---------------------

[](#custom-http-transport)

```
use Esauti\Http\HttpTransportInterface;
use Esauti\Http\Response;

class MyTransport implements HttpTransportInterface {
    public function request(string $method, string $path, array $headers = [], array $query = [], ?array $body = null): Response {
        // your implementation
    }
}

$client = new EsautiClient('https://…', [], ['transport' => new MyTransport()]);
```

---

Running Tests
-------------

[](#running-tests)

```
composer install
composer test
```

---

Project Structure
-----------------

[](#project-structure)

```
esauti-php/
├── composer.json
├── phpunit.xml
├── LICENSE
├── README.md
├── CHANGELOG.md
├── src/
│   ├── EsautiClient.php
│   ├── Config.php
│   ├── Auth/
│   │   ├── AuthInterface.php
│   │   ├── BearerAuth.php
│   │   ├── HmacAuth.php
│   │   ├── CompositeAuth.php
│   │   └── NoAuth.php
│   ├── Http/
│   │   ├── HttpTransportInterface.php
│   │   ├── GuzzleTransport.php
│   │   └── Response.php
│   ├── Api/
│   │   ├── ApiClient.php
│   │   ├── AbstractResource.php
│   │   ├── Contacts.php
│   │   ├── Campaigns.php
│   │   ├── Assets.php
│   │   ├── Categories.php
│   │   ├── Forms.php
│   │   ├── Notifications.php
│   │   ├── Fields.php
│   │   ├── PointGroups.php
│   │   ├── Reports.php
│   │   └── Sms.php
│   ├── Events/
│   │   ├── EventsClient.php
│   │   ├── EventType.php
│   │   ├── EventRegistry.php
│   │   ├── EventValidator.php
│   │   ├── EventEnvelope.php
│   │   └── DeadLetterSink.php
│   ├── Exception/
│   │   ├── ApiException.php
│   │   ├── NetworkException.php
│   │   └── ValidationException.php
│   ├── Logger/
│   │   ├── LoggerInterface.php
│   │   ├── NullLogger.php
│   │   └── DebugLogger.php
│   └── Retry/
│       └── RetryPolicy.php
├── tests/
│   ├── ApiClientTest.php
│   ├── EventValidationTest.php
│   ├── HmacAuthTest.php
│   ├── IdempotencyTest.php
│   └── RetryTest.php
└── examples/
    ├── api_contacts.php
    ├── send_event.php
    └── hmac_event.php

```

###  Health Score

35

—

LowBetter than 77% of packages

Maintenance91

Actively maintained with recent releases

Popularity0

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity38

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% 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

Unknown

Total

1

Last Release

42d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/38338353?v=4)[Hachther Co.](/maintainers/hachther)[@hachther](https://github.com/hachther)

---

Top Contributors

[![hachther](https://avatars.githubusercontent.com/u/38338353?v=4)](https://github.com/hachther "hachther (2 commits)")

---

Tags

sdkeventscrmesauti

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/esauti-esauti-php/health.svg)

```
[![Health](https://phpackages.com/badges/esauti-esauti-php/health.svg)](https://phpackages.com/packages/esauti-esauti-php)
```

###  Alternatives

[aws/aws-sdk-php

AWS SDK for PHP - Use Amazon Web Services in your PHP project

6.3k532.1M2.5k](/packages/aws-aws-sdk-php)[tencentcloud/tencentcloud-sdk-php

TencentCloudApi php sdk

3751.2M45](/packages/tencentcloud-tencentcloud-sdk-php)[clicksend/clicksend-php

351.6M11](/packages/clicksend-clicksend-php)[eslazarev/wildberries-sdk

Wildberries OpenAPI clients (generated).

232.5k](/packages/eslazarev-wildberries-sdk)[yoti/yoti-php-sdk

Yoti SDK for quickly integrating your PHP backend with Yoti

27565.3k1](/packages/yoti-yoti-php-sdk)[files.com/files-php-sdk

Files.com PHP SDK

2478.1k](/packages/filescom-files-php-sdk)

PHPackages © 2026

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