PHPackages                             pekopt/elastic-apm-php-agent - 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. [Logging &amp; Monitoring](/categories/logging)
4. /
5. pekopt/elastic-apm-php-agent

ActiveLibrary[Logging &amp; Monitoring](/categories/logging)

pekopt/elastic-apm-php-agent
============================

0.2.5(7y ago)09MITPHPPHP &gt;= 5.5

Since Feb 2Pushed 7y agoCompare

[ Source](https://github.com/PekopT/elastic-apm-php-agent)[ Packagist](https://packagist.org/packages/pekopt/elastic-apm-php-agent)[ RSS](/packages/pekopt-elastic-apm-php-agent/feed)WikiDiscussions master Synced today

READMEChangelog (2)Dependencies (4)Versions (9)Used By (0)

Elastic APM: PHP Agent
======================

[](#elastic-apm-php-agent)

[![Build Status](https://camo.githubusercontent.com/83c9ffd1f4d8f41caf46cb5b6f480a39a67575c524b36686088063a025da4962/68747470733a2f2f7472617669732d63692e6f72672f686f74727573682f656c61737469632d61706d2d7068702d6167656e742e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/hotrush/elastic-apm-php-agent)

This is a PHP agent for Elastic.co's APM product: . Please note that this agent is still **experimental** and not ready for any production usage.

**Note:** This is fork. Original package repository - [philkra/elastic-apm-php-agent](https://github.com/philkra/elastic-apm-php-agent)

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

[](#installation)

The recommended way to install the agent is through [Composer](http://getcomposer.org).

Run the following composer command

```
php composer.phar require hotrush/elastic-apm-php-agent
```

After installing, you need to require Composer's autoloader:

```
require 'vendor/autoload.php';
```

Usage
-----

[](#usage)

### Initialize the Agent with minimal Config

[](#initialize-the-agent-with-minimal-config)

```
$agent = new \Hotrush\Agent(['appName' => 'demo']);
```

When creating the agent, you can directly inject shared contexts registry. Contexts registry contains info about user, request, tags and custom.

```
$contexts = new \Hotrush\Context\ContextsRegistry();
$contexts->getUser()
    ->setId(123)
    ->setUsername('User')
    ->setEmail('email@domain.com');
$contexts->getTags()->addTag('tag_name', 'tag_value');
$contexts->getRequest()->setRequestData(['body' => ['foo' => 'bar']]);
$contexts->getCustom()->addCustom('custom_key', [
    'id' => 1,
    'name' => 'Hello',
]);
$agent = new \Hotrush\Agent([ 'appName' => 'with-custom-context' ], $contexts);
```

### Capture Errors and Exceptions

[](#capture-errors-and-exceptions)

The agent can capture all types or errors and exceptions that are implemented from the interface `Throwable` ().

```
$agent->captureThrowable( new Exception() );
```

### Transaction without minimal Meta data and Context

[](#transaction-without-minimal-meta-data-and-context)

```
$trxName = 'Demo Simple Transaction';
$agent->startTransaction($trxName);
// Do some stuff you want to watch ...
$agent->stopTransaction($trxName);
```

### Transaction with Meta data and Contexts

[](#transaction-with-meta-data-and-contexts)

```
$trxName = 'Demo Transaction with more Data';
$agent->startTransaction($trxName);
// Do some stuff you want to watch ...
$agent->stopTransaction($trxName, [
    'result' => '200',
    'type'   => 'demo'
]);
$agent->getTransaction($trxName)->getContextsRegistry()->getUser()->setId(123);
$agent->getTransaction($trxName)->getContextsRegistry()->getTags()->addTag('tag', 'value');
$agent->getTransaction($trxName)->getContextsRegistry()->getTags()->setTags( [ 'k1' => 'v1', 'k2' => 'v2' ] );
```

Tests
-----

[](#tests)

```
vendor/bin/phpunit
```

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 52.6% 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 ~18 days

Recently: every ~12 days

Total

7

Last Release

2911d ago

PHP version history (2 changes)0.1.2PHP &gt;= 7.0

0.2.4PHP &gt;= 5.5

### Community

Maintainers

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

---

Top Contributors

[![hotrush](https://avatars.githubusercontent.com/u/1247004?v=4)](https://github.com/hotrush "hotrush (10 commits)")[![thinkspill](https://avatars.githubusercontent.com/u/822133?v=4)](https://github.com/thinkspill "thinkspill (4 commits)")[![PekopT](https://avatars.githubusercontent.com/u/1135374?v=4)](https://github.com/PekopT "PekopT (3 commits)")[![philkra](https://avatars.githubusercontent.com/u/35487337?v=4)](https://github.com/philkra "philkra (2 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/pekopt-elastic-apm-php-agent/health.svg)

```
[![Health](https://phpackages.com/badges/pekopt-elastic-apm-php-agent/health.svg)](https://phpackages.com/packages/pekopt-elastic-apm-php-agent)
```

###  Alternatives

[spatie/laravel-health

Monitor the health of a Laravel application

85810.0M83](/packages/spatie-laravel-health)[subzerobo/elastic-apm-php-agent

PHP Agent for Elastic APM With Intake API V2 Support + UDP Support

1119.1k](/packages/subzerobo-elastic-apm-php-agent)

PHPackages © 2026

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