PHPackages                             srkt/amplitude-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. [Utility &amp; Helpers](/categories/utility)
4. /
5. srkt/amplitude-php

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

srkt/amplitude-php
==================

Amplitude PHP SDK

1.0.0(5y ago)01.2kMITPHPPHP &gt;=7.1

Since Jun 16Pushed 5y ago1 watchersCompare

[ Source](https://github.com/yuriy-srkt/amplitude-php)[ Packagist](https://packagist.org/packages/srkt/amplitude-php)[ RSS](/packages/srkt-amplitude-php/feed)WikiDiscussions master Synced 6d ago

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

Amplitude PHP SDK
=================

[](#amplitude-php-sdk)

[![PHP Composer](https://github.com/yuriy-srkt/amplitude-php/workflows/PHP%20Composer/badge.svg?branch=master)](https://github.com/yuriy-srkt/amplitude-php/workflows/PHP%20Composer/badge.svg?branch=master)

Multifunctional [Amplitude](https://amplitude.com/) REST API PHP SDK with PSR-7 and PSR-18 support (HTTP Request, Response and Client interfaces).

- A simple interface for tracking your [events](https://developers.amplitude.com/docs/http-api-deprecated) and [identities](https://developers.amplitude.com/docs/identify-api) into Amplitude service.
- Can send both single events (identities) and bunch of them.
- Uses PSR-7 interfaces for requests and responses, PSR-18 for HTTP client. This allows you to utilize other PSR-18 compatible libraries SDK. Guzzle HTTP client used by default.
- Supports Amplitude features: platform data, revenue data, etc.

Installing Amplitude PHP SDK
----------------------------

[](#installing-amplitude-php-sdk)

The recommended way to install SDK is through [Composer](https://getcomposer.org/).

```
composer require srkt/amplitude-php
```

Examples
--------

[](#examples)

There are two types of library usage: simple "one method call" and full featured OOP styled one.

### Event tracking

[](#event-tracking)

#### Create client

[](#create-client)

```
// Create new Amplitude client
$client = new \Srkt\Amplitude\Client('your-api-key-goes-here');
```

#### Simple

[](#simple)

```
// Simple event tracking:
$client->log(
    'user123',
    'testEventType',
    ['eventProperty' => 'value'],
    ['userProperty' => 'value'],
    'deviceId'
); // PSR-7 Response
```

#### Full event object

[](#full-event-object)

```
// Full data event tracking
$event = new \Srkt\Amplitude\Model\Event('user1', 'registration');

// This is not full list of data setters, please check all Event class setters
$event
    ->setAppVersion('1.0.0')
    ->setCountry('USA')
    ->setCity('New York')
    ->setRevenueData(new \Srkt\Amplitude\Model\RevenueData(10.00, 5.00, 2, 'product1', 'sell'))
    ->setLanguage('en')
    ->setDeviceId('device-id-1')
    ->setPlatformData(
        new \Srkt\Amplitude\Model\PlatformData('Moblie', 'Android', '11.0')
    )
    ->setEventProperties(['property' => 'value'])
    ->setUserProperties(new \Srkt\Amplitude\Model\UserProperties(['userProperty' => 'value']));

$client->logEvent($event); // PSR-7 Response
```

#### Event with no userId but with deviceId

[](#event-with-no-userid-but-with-deviceid)

```
// Event without userId tracking
$event = new \Srkt\Amplitude\Model\Event(null, 'registration', [], null, null, 'device-id1');
$client->logEvent($event); // PSR-7 Response
```

#### Multiple events in one request

[](#multiple-events-in-one-request)

```
$events = [
    new \Srkt\Amplitude\Model\Event('user1', 'registration'),
    new \Srkt\Amplitude\Model\Event('user1', 'addPhoto'),
    new \Srkt\Amplitude\Model\Event('user1', 'addInfo'),
];
$client->logEvents($events); // PSR-7 Response
```

### User Identities tracking

[](#user-identities-tracking)

#### Simple

[](#simple-1)

```
$client = new \Srkt\Amplitude\Client('your-api-key-goes-here');
$identity = new \Srkt\Amplitude\Model\UserIdentity(
    'userId1',
    new \Srkt\Amplitude\Model\UserProperties(['userProperty' => 'value'])
);
$client->identifyUser($identity); // PSR-7 Response
```

#### Full identity object

[](#full-identity-object)

```
// Full data identity tracking
$identity = new \Srkt\Amplitude\Model\UserIdentity(
    'userId1',
    new \Srkt\Amplitude\Model\UserProperties(['userProperty' => 'value'])
);

// This is not full list of data setters, please check all Event class setters
$identity
    ->setDeviceId('device-id')
    ->setLanguage('en')
    ->setStartVersion('1.0.0')
    ->setPlatformData()
    ->setPaying('paying')
    ->setPlatformData(
        new \Srkt\Amplitude\Model\PlatformData('Moblie', 'Android', '11.0')
    );

$client->identifyUser($identity); // PSR-7 Response
```

#### Multiple identities in one request

[](#multiple-identities-in-one-request)

```
$identities = [
    new \Srkt\Amplitude\Model\UserIdentity('user1', new \Srkt\Amplitude\Model\UserProperties(['property' => 'value'])),
    new \Srkt\Amplitude\Model\UserIdentity('user2', new \Srkt\Amplitude\Model\UserProperties(['property' => 'value'])),
    new \Srkt\Amplitude\Model\UserIdentity('user3', new \Srkt\Amplitude\Model\UserProperties(['property' => 'value'])),
];
$client->identifyUsers($identities); // PSR-7 Response
```

### Advanced usage

[](#advanced-usage)

You can change default Guzzle HTTP client to any other supports PSR-18 interface, or you can setup Guzzle client options.

```
$client = new \Srkt\Amplitude\Client('your-api-key-goes-here');
// Client adapter used for Guzzle versions prior to 7.0.0
$httpClient = new \Srkt\Amplitude\Http\Client\GuzzlePsr18ClientAdapter([
    'timeout'         => 0,
    'allow_redirects' => false,
    'proxy'           => '192.168.16.1:10'
]);
$client->setHttpClient($httpClient);
```

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity50

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

2161d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1323681?v=4)[Ravi Kanth](/maintainers/srkt)[@srkt](https://github.com/srkt)

---

Top Contributors

[![yuriy-srkt](https://avatars.githubusercontent.com/u/19589319?v=4)](https://github.com/yuriy-srkt "yuriy-srkt (8 commits)")

---

Tags

sdktrackinganalyticsamplitude

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[zumba/amplitude-php

PHP SDK for Amplitude

409.5M5](/packages/zumba-amplitude-php)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)[minube/amplitude-php

Amplitude SDK for PHP - Use Amplitude in your PHP project

1455.7k](/packages/minube-amplitude-php)[cornford/googlitics

An easy way to integrate Google Analytics with Laravel.

3310.2k](/packages/cornford-googlitics)[axllent/silverstripe-analytics-js

Google Universal Analytics tracking code for Silverstripe

1721.3k](/packages/axllent-silverstripe-analytics-js)

PHPackages © 2026

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