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

ActiveLibrary[API Development](/categories/api)

ominity/ominity-api-php
=======================

Ominity API library for PHP.

v1.4.0(2mo ago)02.0k1BSD-2-ClausePHPPHP ^7.2|^8.0

Since Aug 22Pushed 2mo agoCompare

[ Source](https://github.com/ominity/ominity-api-php)[ Packagist](https://packagist.org/packages/ominity/ominity-api-php)[ Docs](https://www.ominity.com/)[ RSS](/packages/ominity-ominity-api-php/feed)WikiDiscussions main Synced 2w ago

READMEChangelog (10)Dependencies (12)Versions (44)Used By (1)

Ominity API client for PHP
==========================

[](#ominity-api-client-for-php)

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

[](#requirements)

To use the Ominity API client, the following things are required:

- PHP &gt;= 7.0
- Up-to-date OpenSSL (or other SSL/TLS toolkit)

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

[](#installation)

### Using Composer

[](#using-composer)

The easiest way to install the Ominity API client is by using [Composer](http://getcomposer.org/doc/00-intro.md). You can require it with the following command:

```
composer require ominity/ominity-api-php
```

### Manual Installation

[](#manual-installation)

If you're not familiar with using composer we've added a ZIP file to the releases containing the API client and all the packages normally installed by composer. Download the `ominity-api-php.zip` from the [releases page](https://github.com/ominity/ominity-api-php/releases).

Include the `vendor/autoload.php`

Usage
-----

[](#usage)

Initializing the Ominity API client, and setting your endpoint and API key.

```
$ominity = new \Ominity\Api\OminityApiClient();
$ominity->setApiEndpoint("https://ominity.example.com/api");
$ominity->setApiKey("q48fd94qs98fd4sqf89fza9sqd89f4");
```

With the `OminityApiClient` you can now access any of the following endpoints by selecting them as a property of the client:

### Tracking events

[](#tracking-events)

The PHP client now exposes the public tracking endpoint under `tracking->events`.

```
$result = $ominity->tracking->events->track([
    'event' => 'page_view',
    'timestamp' => gmdate(DATE_ATOM),
    'visitorId' => '648cd59e-8f79-40a7-a4de-1fb65b42c00c',
    'url' => 'https://shop.example.com/products/lounge-chair',
    'metadata' => [
        'origin_resource' => [
            'resource' => 'page',
            'id' => 42,
            'slug' => 'lounge-chair',
        ],
    ],
]);

$visitorId = $result->visitorId;
```

When proxying browser events through your own backend, you can preserve the real visitor IP and user agent on the next request:

```
$ominity
    ->addRequestHeaders([
        'X-Forwarded-For' => '203.0.113.10',
        'X-Real-IP' => '203.0.113.10',
        'X-Ominity-Client-IP' => '203.0.113.10',
        'User-Agent' => $_SERVER['HTTP_USER_AGENT'] ?? '',
    ])
    ->tracking->events->track([
        'event' => 'page_view',
        'timestamp' => gmdate(DATE_ATOM),
    ]);
```

### Enabling debug mode

[](#enabling-debug-mode)

When troubleshooting, it can be highly beneficial to have access to the submitted request within the `ApiException`. To safeguard against inadvertently exposing sensitive request data in your local application logs, the debugging feature is initially turned off.

To enable debugging and inspect the request:

```
/** @var $ominity \Ominity\Api\OminityApiClient */
$ominity->enableDebugging();

try {
    $ominity->commerce->products->get(1);
} catch (\Ominity\Api\Exceptions\ApiException $exception) {
    $request = $exception->getRequest();
}
```

If you are recording instances of `ApiException`, the request details will be included in the logs. It is vital to ensure that no sensitive information is retained within these logs and to perform cleanup after debugging is complete.

To disable debugging again:

```
/** @var $ominity \Ominity\Api\OminityApiClient */
$ominity->disableDebugging();
```

License
-------

[](#license)

[BSD (Berkeley Software Distribution) License](https://opensource.org/licenses/bsd-license.php). Copyright (c) 2024, Ominity

###  Health Score

45

—

FairBetter than 91% of packages

Maintenance86

Actively maintained with recent releases

Popularity15

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity58

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

Recently: every ~52 days

Total

43

Last Release

72d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/167320342?v=4)[Ominity](/maintainers/ominity)[@ominity](https://github.com/ominity)

---

Top Contributors

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

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

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

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

###  Alternatives

[composer/composer

Composer helps you declare, manage and install dependencies of PHP projects. It ensures you have the right stack everywhere.

29.5k199.6M3.4k](/packages/composer-composer)[matomo/matomo

Matomo is the leading Free/Libre open analytics platform

21.7k39.6k](/packages/matomo-matomo)[cakephp/cakephp

The CakePHP framework

8.9k20.0M1.9k](/packages/cakephp-cakephp)[mollie/mollie-api-php

Mollie API client library for PHP. Mollie is a European Payment Service provider and offers international payment methods such as Mastercard, VISA, American Express and PayPal, and local payment methods such as iDEAL, Bancontact, SOFORT Banking, SEPA direct debit, Belfius Direct Net, KBC Payment Button and various gift cards such as Podiumcadeaukaart and fashioncheque.

60316.6M98](/packages/mollie-mollie-api-php)[pimcore/pimcore

Content &amp; Product Management Framework (CMS/PIM/E-Commerce)

3.8k3.9M535](/packages/pimcore-pimcore)[getgrav/grav

Modern, Crazy Fast, Ridiculously Easy and Amazingly Powerful Flat-File CMS

15.6k88.1k1](/packages/getgrav-grav)

PHPackages © 2026

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