PHPackages                             myzero1/yii2-log - 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. myzero1/yii2-log

ActiveYii2-module

myzero1/yii2-log
================

It can log by text,screenshot or both.

1.1.4(7y ago)051BSD-3-ClausePHP

Since Sep 2Pushed 7y agoCompare

[ Source](https://github.com/myzero1/yii2-log)[ Packagist](https://packagist.org/packages/myzero1/yii2-log)[ RSS](/packages/myzero1-yii2-log/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (8)Dependencies (3)Versions (10)Used By (0)

yii2-log
========

[](#yii2-log)

The log module,include text log, screenshot log, and both.

Show time
---------

[](#show-time)

[![](https://github.com/myzero1/show-time/raw/master/yii2-log/screenshot/1.png)](https://github.com/myzero1/show-time/blob/master/yii2-log/screenshot/1.png)[![](https://github.com/myzero1/show-time/raw/master/yii2-log/screenshot/2.png)](https://github.com/myzero1/show-time/blob/master/yii2-log/screenshot/2.png)

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

[](#installation)

The preferred way to install this module is through [composer](http://getcomposer.org/download/).

Either run

```
php composer.phar require myzero1/yii2-log：1.*

```

or add

```
"myzero1/yii2-log": "*"

```

to the require section of your `composer.json` file.

Setting
-------

[](#setting)

Once the extension is installed, simply modify your application configuration(main.php) as follows:

```
return [
    ......
    'bootstrap' => [
        ......
        'z1log',
        ......
    ],
    'modules' => [
        ......
        'z1log' => [
            'class' => '\myzero1\log\Module',
            'params' => [
                'urlManager' => [
                    'rules' => [
                        // 'rate/area/index' => 'rate/jf-core-area/index',
                    ],
                ],
                'remarksFieldsKey' => [
                    'remark', // default filed
                    // 'r1', // custom field, can add it by yourself
                ],
                'userInfo' => [
                    'id' => function(){
                        if(\Yii::$app->user->isGuest){
                            $id = 0;
                        } else {
                            $id = \Yii::$app->user->identity->id;
                        }

                        return $id;
                    },
                    'name' => function(){
                        if(\Yii::$app->user->isGuest){
                            $name = 'system';
                        } else {
                            $name = \Yii::$app->user->identity->username;
                        }

                        return $name;
                    }
                ],
                'template' => [
                    'user2/create' => [
                        'model' => 'all', // text,screenshot,all
                        'addToTable' => 'user', // for creating
                        'text' => function(){
                            return '添加用户';
                        },
                        'screenshot' => 'user2/update', // The template of screenshot
                        'obj' => [
                            'label' => '.field-user2-username .control-label',
                            'value' => '#user2-username',
                        ],
                        'remarks' => [// the items must be Closure
                            'remark' => function(){
                                return sprintf('Create it at %s.', date('Y-m-d H:i:s'));
                            },
                            // 'r1' => function(){return 'r1'.time();},
                        ],
                    ],
                    'user2/update' => [
                        'model' => 'all', // text,screenshot,all
                        'text' => function(){
                            return '修改用户';
                        },
                        'screenshot' => 'user2/update', // The template of screenshot
                        'obj' => [
                            'label' => '.field-user2-username .control-label',
                            'value' => '#user2-username',
                        ],
                        'remarks' => [// the items must be Closure
                            'remark' => function(){
                                return sprintf('Update it at %s.', date('Y-m-d H:i:s'));
                            },
                        ],
                    ],
                    'user2/delete' => [
                        'model' => 'all', // text,screenshot,all
                        'text' => function(){
                            return '删除用户';
                        },
                        'screenshot' => 'user2/update', // The template of screenshot
                        'obj' => [
                            'label' => '.field-user2-username .control-label',
                            'value' => '#user2-username',
                        ],
                        'remarks' => [// the items must be Closure
                            'remark' => function(){
                                return sprintf('Delete it at %s.', date('Y-m-d H:i:s'));
                            },
                        ],
                    ],
                ],
            ],
        ],
        ......
    ],
    ......
];
```

Apply migrations:

```
    php yii migrate --migrationPath=@vendor/myzero1/yii2-log/src/migrations
```

Usage
-----

[](#usage)

You can access Demo through the following URL:

```
http://localhost/path/to/index.php?r=z1log/z1log-log/index

```

or if you have enabled pretty URLs, you may use the following URL:

```
http://localhost/path/to/index.php/z1log/z1log-log/index

```

### use z1logAdd($model, $screenshot, $screenshotParams, $text, $obj, $remarks) anywhere

[](#use-z1logaddmodel-screenshot-screenshotparams-text-obj-remarks-anywhere)

```
\myzero1\log\components\export\Export::z1logAdd('all', 'user2/update', ['id'=>$model->id], 'create user', sprintf('username:%s', $model->username), ['remark'=>'this is a remark']);
```

Usage scenario
--------------

[](#usage-scenario)

- Just add config to `mian.php`,when we want to add log,there is updating with the action.· `The screenshots will record the data before updating.`
- Use `z1logAdd` api,when we are create a new record.we get he id of the new record at action,so easy .

```
    /**
     * Creates a new User2 model.
     * If creation is successful, the browser will be redirected to the 'view' page.
     * @return mixed
     */
    public function actionCreate()
    {
        $model = new User2();

        if ($model->load(Yii::$app->request->post()) && $model->save()) {

            \myzero1\log\components\export\Export::z1logAdd('all', 'user2/update', ['id'=>$model->id], 'create user', sprintf('username:%s', $model->username), '');

            Yii::$app->getSession()->setFlash('success', '添加成功');
            return \myzero1\adminlteiframe\helpers\Tool::redirectParent(['index']);
        } else {
            return $this->render('create', [
                'model' => $model,
            ]);
        }
    }
```

- Use `z1logAdd` api,when we want to add log,but there is not updating with the action.

###  Health Score

29

—

LowBetter than 59% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity68

Established project with proven stability

 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

Every ~18 days

Recently: every ~29 days

Total

8

Last Release

2685d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/22048203?v=4)[myzero1](/maintainers/myzero1)[@myzero1](https://github.com/myzero1)

---

Top Contributors

[![myzero1](https://avatars.githubusercontent.com/u/22048203?v=4)](https://github.com/myzero1 "myzero1 (27 commits)")

### Embed Badge

![Health badge](/badges/myzero1-yii2-log/health.svg)

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

###  Alternatives

[craftcms/cms

Craft CMS

3.6k3.6M2.6k](/packages/craftcms-cms)

PHPackages © 2026

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