PHPackages                             sil-org/yii2-email-log-target - 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. sil-org/yii2-email-log-target

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

sil-org/yii2-email-log-target
=============================

Yii2 log target for sending data to email without trace information

1.1.2(9mo ago)02MITPHPPHP ^8.0

Since Apr 13Pushed 9mo ago6 watchersCompare

[ Source](https://github.com/sil-org/yii2-email-log-target)[ Packagist](https://packagist.org/packages/sil-org/yii2-email-log-target)[ RSS](/packages/sil-org-yii2-email-log-target/feed)WikiDiscussions main Synced today

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

yii2-email-log-target
=====================

[](#yii2-email-log-target)

Custom version of yii\\log\\EmailTarget to exclude trace information from messages.

What &amp; Why
--------------

[](#what--why)

The built in `yii\log\EmailTarget` class does a nice job of serializing and sending log and exception messages via email. Unfortunately when the message is an exception itself the exception is serialized to string using default` \Exception::__toString()` method which includes stack trace information. The Yii logger component allows configuration of whether or not to include trace information but it does not apply to exception messages.

This class is a modified version of `yii\log\EmailTarget` to ensure no trace information is set in the email.

Have the log prefix (if used)
-----------------------------

[](#have-the-log-prefix-if-used)

Example configuration `['components']['log']['targets']` array):

```
[
    'class' => 'Sil\Log\EmailTarget',
    'levels' => ['error'],
    'except' => [
        'yii\web\HttpException:401',
        'yii\web\HttpException:404',
    ],
    'logVars' => [], // Disable logging of _SERVER, _POST, etc.
    'prefix' => function($message) use ($appEnv) {
        $prefix = 'env=' . $appEnv . PHP_EOL;

        // There is no user when a console command is run
        try {
            $appUser = \Yii::$app->user;
        } catch (\Exception $e) {
            $appUser = Null;
        }
        if ($appUser && ! \Yii::$app->user->isGuest){
            $prefix .= 'user='.\Yii::$app->user->identity->email . PHP_EOL;
        }

        // Try to get requested url and method
        try {
            $request = \Yii::$app->request;
            $prefix .= 'Requested URL: ' . $request->getUrl() . PHP_EOL;
            $prefix .= 'Request method: ' . $request->getMethod() . PHP_EOL;
        } catch (\Exception $e) {
            $prefix .= 'Requested URL: not available';
        }

        return PHP_EOL . $prefix;
    },
],

```

License
-------

[](#license)

This is released under the MIT license (see LICENSE file).

###  Health Score

38

—

LowBetter than 83% of packages

Maintenance56

Moderate activity, may be stable

Popularity2

Limited adoption so far

Community19

Small or concentrated contributor base

Maturity70

Established project with proven stability

 Bus Factor1

Top contributor holds 53.3% 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 ~1539 days

Total

3

Last Release

292d ago

PHP version history (2 changes)1.0.1PHP &gt;=5.4.0

1.1.1PHP ^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/836739aa4f60c754dc9a4a547ebd0c166e4b6e855d9f119df2be5aec92f3a375?d=identicon)[forevermatt](/maintainers/forevermatt)

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

![](https://www.gravatar.com/avatar/5256eacae3564eb6d3e954abc6552ed99a6d948d94d2b07cc1dc9dabb0bce108?d=identicon)[jason-jackson](/maintainers/jason-jackson)

![](https://www.gravatar.com/avatar/1948ad6f3cf2b7f0b3ca357e8014830ceb955d79f8e13777288c6bd3ed1b8545?d=identicon)[Schparky](/maintainers/Schparky)

![](https://www.gravatar.com/avatar/4af996082efafeccd517cb8e86c671d40d492f2b7a2a0202aabf49153272ca3c?d=identicon)[devon-sil](/maintainers/devon-sil)

---

Top Contributors

[![jason-jackson](https://avatars.githubusercontent.com/u/35783387?v=4)](https://github.com/jason-jackson "jason-jackson (8 commits)")[![Baggerone](https://avatars.githubusercontent.com/u/8058522?v=4)](https://github.com/Baggerone "Baggerone (2 commits)")[![briskt](https://avatars.githubusercontent.com/u/3172830?v=4)](https://github.com/briskt "briskt (2 commits)")[![devon-sil](https://avatars.githubusercontent.com/u/122382412?v=4)](https://github.com/devon-sil "devon-sil (1 commits)")[![fillup](https://avatars.githubusercontent.com/u/556105?v=4)](https://github.com/fillup "fillup (1 commits)")[![longrunningprocess](https://avatars.githubusercontent.com/u/4412848?v=4)](https://github.com/longrunningprocess "longrunningprocess (1 commits)")

---

Tags

logjsonemailyii2

### Embed Badge

![Health badge](/badges/sil-org-yii2-email-log-target/health.svg)

```
[![Health](https://phpackages.com/badges/sil-org-yii2-email-log-target/health.svg)](https://phpackages.com/packages/sil-org-yii2-email-log-target)
```

###  Alternatives

[lav45/yii2-activity-logger

Tools to store user activity log for Yii2

3460.8k](/packages/lav45-yii2-activity-logger)[index0h/yii2-log

Many Yii2 log targets

48210.0k](/packages/index0h-yii2-log)[zhuravljov/yii2-logreader

Yii2 Log Reader

3332.1k](/packages/zhuravljov-yii2-logreader)

PHPackages © 2026

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