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

Abandoned → [sil-org/yii2-email-log-target](/?search=sil-org%2Fyii2-email-log-target)Library[Logging &amp; Monitoring](/categories/logging)

silinternational/yii2-email-log-target
======================================

Yii2 log target for sending data to email without trace information

1.1.2(9mo ago)04.6kMITPHPPHP ^8.0

Since Apr 13Pushed 9mo ago6 watchersCompare

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

READMEChangelog (3)Dependencies (1)Versions (7)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

44

—

FairBetter than 91% of packages

Maintenance57

Moderate activity, may be stable

Popularity17

Limited adoption so far

Community18

Small or concentrated contributor base

Maturity72

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

287d 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/a5e188393958c4505bb06d9e79ed99a47d1cd42551142f02ef364d8268449ef8?d=identicon)[fillup](/maintainers/fillup)

![](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)

---

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/silinternational-yii2-email-log-target/health.svg)

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

###  Alternatives

[index0h/yii2-log

Many Yii2 log targets

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

Yii2 Log Reader

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

PHPackages © 2026

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