PHPackages                             alishojaeiir/yii2-elastic-apm - 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. alishojaeiir/yii2-elastic-apm

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

alishojaeiir/yii2-elastic-apm
=============================

Elastic Agent for Yii2 Framework

1.1.1(1y ago)04BSD-3-ClausePHPPHP &gt;=7.1.0

Since Nov 30Pushed 1y agoCompare

[ Source](https://github.com/alishojaeiir/yii2-elastic-apm)[ Packagist](https://packagist.org/packages/alishojaeiir/yii2-elastic-apm)[ RSS](/packages/alishojaeiir-yii2-elastic-apm/feed)WikiDiscussions master Synced 1mo ago

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

yii2-elastic-apm
================

[](#yii2-elastic-apm)

Elastic Agent for Yii2 Framework

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

[](#installation)

Let install this module via composer

composer require --prefer-dist --profile -vvv alishojaeiir/yii2-elastic-apm

Configuration
-------------

[](#configuration)

```
'apm' => [
    'class' => 'ivoglent\yii2\apm\Module',
    'configs' => [
        'agent' => [
            'serverUrl' => 'localhost:8200', //Host and port of APM server
            'name' => 'Service name', //Service name
            'token' => APM_TOKEN, //Token
            'environment' => 'dev' //APM environment
            'client_setting' => [
                "timeout" => 2 //timeout in second
            ]
        ],
        'skipExceptions' => [
            //List of exceptions which you want to ignore
            \yii\web\NotFoundHttpException::class,
            \yii\web\UnauthorizedHttpException::class,
        ],
        'skipCommands' => [
            //List of command you dont want to track
            'rabbitmq/consume',
        ],
    ],
    'enabled' => true // or false,
]

```

To enable database monitoring, let config the DB command like :

```
'components' => [
    'db' => [
        'class' => 'yii\db\Connection',
        'dsn' => '',
        'username' => '',
        'password' => '',
        'charset' => 'utf8mb4',
        'commandClass' => APM_ENABLED ? 'ivoglent\yii2\apm\components\db\mysql\Command' : '\yii\db\Command',
    ]
]

```

NOTE Rememeber add apm module to bootstrap section:

```
'bootstrap' => ['log', 'apm'],

```

Transaction
-----------

[](#transaction)

This module will auto start new transaction after BEFORE\_REQUEDT event. But you can manual start new transaction on Console application like consumer ..etc

```
$transactionId = Uuid::uuid4()->toString();
$txtName = sprintf('consumer.%s', str_replace('-', '.', $queue->getName()));
Yii::$app->getModule('apm')->getAgent()->startTransaction($txtName, 'consumer', App::$app->getRequestId());
Yii::$app->getModule('apm')->getAgent()->setTransactionId($transactionId);

```

and stop

```
Yii::$app->getModule('apm')->getAgent()->stopTransaction();

```

Trace
-----

[](#trace)

Start new span

```
$span = Yii::$app->getModule('apm')->getAgent()->startTrace('Process::'.$reflect->getShortName(), 'process');

```

and stop :

```
Yii::$app->getModule('apm')->getAgent()->stopTrace($span->getId());

```

Error / exception notify
------------------------

[](#error--exception-notify)

try {

} catch (\\Exception $throwable) { Yii::$app-&gt;getModule('apm')-&gt;getAgent()-&gt;notifyException($throwable); }

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance42

Moderate activity, may be stable

Popularity3

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity35

Early-stage or recently created project

 Bus Factor1

Top contributor holds 73.1% 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 ~28 days

Total

3

Last Release

471d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/cc76f616799ce3dc993be09bd9e84d6920b1f2684c2af7aa2fff652ede8ab37c?d=identicon)[m\_a\_sh](/maintainers/m_a_sh)

---

Top Contributors

[![ivoglent](https://avatars.githubusercontent.com/u/4499973?v=4)](https://github.com/ivoglent "ivoglent (19 commits)")[![alishojaeiir](https://avatars.githubusercontent.com/u/25051128?v=4)](https://github.com/alishojaeiir "alishojaeiir (7 commits)")

### Embed Badge

![Health badge](/badges/alishojaeiir-yii2-elastic-apm/health.svg)

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

###  Alternatives

[bedezign/yii2-audit

Yii2 Audit records and displays web/cli requests, database changes, php/js errors and associated data.

201657.4k4](/packages/bedezign-yii2-audit)[mito/yii2-sentry

Yii 2 extension for Sentry

92377.7k](/packages/mito-yii2-sentry)

PHPackages © 2026

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