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

ActiveLibrary

intempt/intempt-php
===================

Intempt PHP SDK — server-side. Data in, decisions out.

v1.0.0(2d ago)016↑600%Apache-2.0PHPPHP &gt;=8.1CI passing

Since Aug 15Pushed 2d agoCompare

[ Source](https://github.com/intempt/intempt-php)[ Packagist](https://packagist.org/packages/intempt/intempt-php)[ Docs](https://intempt.com)[ RSS](/packages/intempt-intempt-php/feed)WikiDiscussions main Synced today

READMEChangelog (1)Dependencies (4)Versions (3)Used By (0)

Intempt PHP SDK
===============

[](#intempt-php-sdk)

Server-side client for [Intempt](https://intempt.com). **Data in, decisions out.**

- **In** — events, identity, consent, commerce
- **Out** — recommendations from your feeds

This is a server library, not a browser one. It holds no per-user state: every call takes its identifier explicitly.

```
composer require intempt/intempt-php
```

Requires PHP 8.1 or newer, with `ext-curl` and `ext-json`. No package dependencies.

Quick start
-----------

[](#quick-start)

```
use Intempt\Intempt;

$intempt = new Intempt([
    'org' => 'my-org',
    'project' => 'my-project',
    'apiKey' => getenv('INTEMPT_API_KEY'),   // "."
    'sourceId' => '684508596718616576',
]);

$intempt->track('purchase', [
    'userId' => 'user@example.com',
    'properties' => ['total' => 99.99],
]);

$feed = $intempt->recommend([
    'userId' => 'user@example.com',
    'feedId' => '5292',
    'fields' => ['id', 'title'],
]);
```

By default each call sends one request and returns when the server responds.

API
---

[](#api)

callreturnsendpoint`new Intempt($config)`client—`track($event, $options)``void``POST …/track``trackBatch($events)``void``POST …/track`, chunked`identify($options)``void``POST …/track` (reserved `Identify`)`group($options)``void``POST …/track` (reserved `Identify`)`alias($options)``void``POST …/track` (reserved `Identify`)`consent->grant($options)``void``POST …/consents/data``consent->revoke($options)``void``POST …/consents/data``ecommerce->productViewed($options)``void``POST …/track``ecommerce->addedToCart($options)``void``POST …/track``ecommerce->ordered($options)``void``POST …/track``recommend($options)``mixed``POST …/feeds/{id}/data``optIn()` / `optOut()` / `isOptedIn()`——`flush()` / `close()``void`—`setConfig($patch)` / `config()` / `buffered()`——Every method throws on failure. Nothing is swallowed.

Identifiers
-----------

[](#identifiers)

`userId` and `accountId`. That is the whole list, and both are values you already own. The platform resolves identity from `userId` itself.

`profileId` and `masterId` are deliberately absent: `profileId` is the anonymous id the browser SDK mints on the device, and a server that invents one creates an orphan profile; `masterId` is assigned after identity resolution and cannot be read from a server.

Batching, and the PHP caveat
----------------------------

[](#batching-and-the-php-caveat)

**Leave batching off under PHP-FPM.** A typical FPM process handles one request and dies, so an in-memory buffer has nowhere to live and `flush()` has nothing useful to do. Turn it on only in a long-running process — a worker, a queue consumer, Swoole, RoadRunner:

```
use Intempt\BatchOptions;

$intempt = new Intempt([
    // …
    'batch' => new BatchOptions(size: 50, flushMs: 5_000, maxQueue: 10_000),
]);
```

`close()` drains for at most 30 seconds, then stops retrying and logs how many events it gave up on. `flush()` is **not** bounded.

### Retry policy

[](#retry-policy)

responsebehaviour413, batch &gt; 1halve the batch size, retry413, batch = 1drop the event, log it, return the width to full429honour `Retry-After`, else exponential backoff5xx, 408, timeoutexponential backoff, floored at 100ms, capped at 10 minother 4xxdrop the batch, log the status and body5 consecutive failuresstop batching and say how many events are stranded3 consecutive 413 dropssay the gateway body limit is the likely cause, once**Delivery is at-least-once.** Ingestion has no idempotency key, so a retry after a lost response duplicates rows. Leave `batch` unset if you would rather a failure surface to your code than be retried.

Credentials
-----------

[](#credentials)

The SDK holds only the encoded credential — it is never a property on any object you can print, and it is redacted in `print_r`, `var_dump`, `var_export` and `__toString`.

**Set `zend.exception_ignore_args=1` in production.** PHP copies call arguments into every stack trace, so your own `new Intempt(['apiKey' => …])` frame carries the key into every later exception, including `getTraceAsString()`. No SDK can fix that from the inside. `tests/CredentialGuardTest.php` proves both halves: what the SDK redacts, and what only that ini setting removes.

Timestamps
----------

[](#timestamps)

`timestamp` accepts a `DateTimeInterface` or epoch milliseconds. It **is** a backfill mechanism between 2010 and 2040; below that the request is rejected, and **above 2040 the server silently replaces your value with its own clock**. Sending seconds where milliseconds were meant lands in that upper band and looks like it just happened.

Not in this SDK
---------------

[](#not-in-this-sdk)

Console and configuration operations belong to the CLI and MCP server. Experiments and personalizations resolve a web experience against a page, and a server has no page.

License
-------

[](#license)

Apache 2.0. Contains code derived from [mixpanel-php](https://github.com/mixpanel/mixpanel-php), also Apache 2.0; see [NOTICE](./NOTICE) for what was taken and what was changed.

###  Health Score

39

—

LowBetter than 84% of packages

Maintenance100

Actively maintained with recent releases

Popularity2

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity43

Maturing project, gaining track record

 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

2d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/fa2c5e4b8d973b9381eefe71149a433d1c6221ba471f5ba77f111e6f94a5bccf?d=identicon)[sidchaudhary](/maintainers/sidchaudhary)

---

Top Contributors

[![sidchaudhary](https://avatars.githubusercontent.com/u/6982241?v=4)](https://github.com/sidchaudhary "sidchaudhary (3 commits)")

---

Tags

analyticscustomer-data-platformevent-trackingintemptphpsdkserver-sideeventsanalyticspersonalizationCDPintempt

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

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

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

###  Alternatives

[doctrine/event-manager

The Doctrine Event Manager is a simple PHP event system that was built to be used with the various Doctrine projects.

6.0k535.0M171](/packages/doctrine-event-manager)[psr/event-dispatcher

Standard interfaces for event handling.

2.3k684.1M1.6k](/packages/psr-event-dispatcher)[laminas/laminas-eventmanager

Trigger and listen to events within a PHP application

1.0k73.5M260](/packages/laminas-laminas-eventmanager)[keen-io/keen-io-bundle

Symfony Bundle for Keen IO

16490.3k](/packages/keen-io-keen-io-bundle)[qodenl/laravel-posthog

Laravel implementation for Posthog

35109.2k](/packages/qodenl-laravel-posthog)[there4/php-analytics-event

Send Google Analytics events from PHP

2541.6k](/packages/there4-php-analytics-event)

PHPackages © 2026

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