PHPackages                             be-lenka/exponea-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. [API Development](/categories/api)
4. /
5. be-lenka/exponea-api

ActiveLibrary[API Development](/categories/api)

be-lenka/exponea-api
====================

PHP SDK for Exponea API

1.0.3(2y ago)1458GPL-3.0-onlyPHPPHP ^7.4 || ^8.0

Since Mar 23Pushed 2y agoCompare

[ Source](https://github.com/be-lenka/exponea-api)[ Packagist](https://packagist.org/packages/be-lenka/exponea-api)[ RSS](/packages/be-lenka-exponea-api/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (4)Dependencies (7)Versions (5)Used By (0)

Exponea API SDK for PHP
=======================

[](#exponea-api-sdk-for-php)

Library contains only basic functionality which is needed for Exponea integration. If you miss some method, please post merge request as our integration just does not need them.

Entire library uses asynchronous Guzzle requests. Please keep in mind that every Promise returned by methods must be called with wait() to be executed.

Public and private key authorization is used in Exponea API so you will need to get 3 values to make valid requests:

- public key
- private key
- project token

Exponea API reference:

Usage example
-------------

[](#usage-example)

Please check following source implementing API intialization and getSystemTime() method:

Usage:

```
use belenka\ExponeaApi\Client;

$client = new Client([
    'public_key' => getenv('EXPONEA_PUBLIC_KEY'),
    'private_key' => getenv('EXPONEA_PRIVATE_KEY'),
    'project_token' => getenv('EXPONEA_PROJECT_TOKEN'),
]);
try {
    $systemTime = $client->tracking()->getSystemTime()->wait(); // returns SystemTime object
} catch (...) { ... }
```

Tracking API
------------

[](#tracking-api)

All methods are contained inside `$client->tracking()` method.

### Set contact agreements (consents)

[](#set-contact-agreements-consents)

Both e-mail and SMS agreements are called *consents* in Exponea. They can be granted or revoked.

```
$event = new Consent(
    new RegisteredCustomer('example@example.com'),
    Consent::CATEGORY_NEWSLETTER,
    Consent::ACTION_GRANT
);
try {
    $client->tracking()->addEvent($event)->wait(); // does not return anything
} catch (...) { ... }
```

### Send purchase

[](#send-purchase)

Exponea needs you to send at least two events: Purchase and PurchaseItem (one for every purchase item).

```
$purchase = new Purchase(
    new RegisteredCustomer('example@example.com'),
    'PREFIX12345', // purchase id
    [
        new Item('012345', 2.99, 1),
    ], // purchase items
    'COD' // payment method
);
$purchaseItem = new PurchaseItem(
    new RegisteredCustomer('example@example.com'),
    'PREFIX12345', // purchase id
    '012345', // item id
    2.99, // price
    2, // quantity
    'SKU012345', // sku (stock keeping unit)
    'Product name',
    new Category('CAT1', 'Some > Category > Breadcrumb')
);
```

You can optionally send voucher used during purchase. Please refer to `$voucher` argument of `Purchase` constructor.

### Update customer properties

[](#update-customer-properties)

```
try {
    $properties = [
        'fidelity_points' => 657,
        'first_name' => 'Marian',
    ];

    $client->tracking()->updateCustomerProperties(
        new RegisteredCustomer('marian@exponea.com'), $properties
    )->wait();
} catch (...) { ... }
```

With this method you can update customer properties. Required field in properties is 'first\_name'.

Catalog API
-----------

[](#catalog-api)

All methods are contained inside `$client->catalog()` method.

### Get catalog name

[](#get-catalog-name)

```
try {
    $catalog = new Catalog('');

    $response = $this->client
        ->catalog()
        ->getCatalogName($catalog)
        ->wait()
    ;
} catch (...) { ... }
```

### Get catalog items

[](#get-catalog-items)

```
try {
    $catalog = new Catalog('');
    $catalog->setQueryParameters([
        'query' => 1,
        'field' => 'item_id',
        'count' => 1
    ]);

    $response = $this->client
        ->catalog()
        ->getCatalogItems($catalog)
        ->wait()
    ;
} catch (...) { ... }
```

### Get catalog item by ID

[](#get-catalog-item-by-id)

```
try {
    $catalog = new Catalog('');
    $catalog->setItemID(1);

    $response = $this->client
        ->catalog()
        ->getCatalogItem($catalog)
        ->wait()
    ;
} catch (...) { ... }
```

### Create catalog item

[](#create-catalog-item)

```
try {
    $catalogItem = new CatalogItem(1, '');
    $catalogItem->setProperties([
        'code' => 'product_code',
        'active' => false,
        'title' => 'product title'
        // etc ...
    ]);

    $response = $this->client
        ->catalog()
        ->createCatalogItem($catalogItem)
        ->wait()
    ;
} catch (...) { ... }
```

### Update catalog item

[](#update-catalog-item)

```
try {
    $catalogItem = new CatalogItem(1, '');
    $catalogItem->setProperties([
        'title' => 'new product title'
        // etc ...
    ]);

    $response = $this->client
        ->catalog()
        ->updateCatalogItem($catalogItem)
        ->wait()
    ;
} catch (...) { ... }
```

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity17

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity53

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

Every ~88 days

Total

4

Last Release

889d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/6ac9bdd7b00d31612964e78d32fde2b346252671da0706c9ff3bc797e5e647b9?d=identicon)[arzzen](/maintainers/arzzen)

---

Top Contributors

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

---

Tags

apibloomreachexponeasdk-php

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/be-lenka-exponea-api/health.svg)

```
[![Health](https://phpackages.com/badges/be-lenka-exponea-api/health.svg)](https://phpackages.com/packages/be-lenka-exponea-api)
```

###  Alternatives

[tencentcloud/tencentcloud-sdk-php

TencentCloudApi php sdk

3731.2M42](/packages/tencentcloud-tencentcloud-sdk-php)[convertkit/convertkitapi

Kit PHP SDK for the Kit API

2167.1k1](/packages/convertkit-convertkitapi)[mapado/rest-client-sdk

Rest Client SDK for hydra API

1125.9k2](/packages/mapado-rest-client-sdk)

PHPackages © 2026

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