PHPackages                             pastuhov/yii2-logstock - 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. [Testing &amp; Quality](/categories/testing)
4. /
5. pastuhov/yii2-logstock

ActiveYii2-extension[Testing &amp; Quality](/categories/testing)

pastuhov/yii2-logstock
======================

The testing extension for the Yii framework

v5.0(6y ago)51.0k5[2 issues](https://github.com/pastuhov/yii2-logstock/issues)1MITPHP

Since Jan 30Pushed 6y ago1 watchersCompare

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

READMEChangelog (10)Dependencies (6)Versions (19)Used By (1)

Snapshot testing extension for Yii 2
====================================

[](#snapshot-testing-extension-for-yii-2)

This extension provides recording and asserting application trace (snapshot). Based on yii\\debug module.

[![Cover](doc/images/terminal.png)](doc/images/terminal.png)

Support
-------

[](#support)

1. Unit
2. Functional (without web server) - does not support
3. Acceptance (throughout web server)

[![Latest Stable Version](https://camo.githubusercontent.com/fa83e3b9f370519d979c6c469a54f7e1b1b86a31bd619034949e1c47fccec574/68747470733a2f2f706f7365722e707567782e6f72672f7061737475686f762f796969322d6c6f6773746f636b2f762f737461626c65)](https://packagist.org/packages/pastuhov/yii2-logstock)[![Build Status](https://camo.githubusercontent.com/eb054d911c6f7272fe05ed7e40c1df6b06ce9f54da5dcd3598620e6d71d4567a/68747470733a2f2f7472617669732d63692e6f72672f7061737475686f762f796969322d6c6f6773746f636b2e737667)](https://travis-ci.org/pastuhov/yii2-logstock)[![Total Downloads](https://camo.githubusercontent.com/8ac18d46c90204b8ca1e5a78302f13e096f7b6fa63fd8e8820d5b0107f18cb73/68747470733a2f2f706f7365722e707567782e6f72672f7061737475686f762f796969322d6c6f6773746f636b2f646f776e6c6f616473)](https://packagist.org/packages/pastuhov/yii2-logstock)

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

[](#installation)

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

Either run

```
php composer.phar require --prefer-dist pastuhov/yii2-logstock

```

or add

```
"require-dev": {
    "pastuhov/yii2-logstock": "~1.0.0"
    ...

```

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

Usage
-----

[](#usage)

Once the extension is installed, simply modify your application configuration as follows:

```
...
if (YII_ENV_TEST) {
    // configuration adjustments for 'test' environment
    $config['bootstrap'][] = 'logstock';
    $config['modules']['logstock'] = [
        'class' => \pastuhov\logstock\Module::class,
    ];

}
...
```

Add `pastuhov\logstock\UnitHelper` to suit config

```
modules:
    enabled:
        - pastuhov\logstock\UnitHelper
```

Use assertLog() method in tests

```
...
    public function testExampleUnitUsage()
    {
        $this->tester->assertLog(function (){
            Yii::info('Test info message');
            Yii::$app->getDb()->createCommand('SELECT * FROM page')->execute();
        }, Yii::$app);
    }
...
```

First time snapshot artifact will be recorded

```
1) Test example unit usage (unit\ExampleUnitTest::testExampleUnitUsage)
Fixture has aggregated. Please restart test!

```

Recorded snapshot:

```
Entry: console

Test info message

SELECT * FROM page

```

On subsequent test runs Logstock will simply compare the rendered output with the previous snapshot. If they match, the test will pass. If they don't match, either the test runner found a bug in your code that should be fixed, or the implementation has changed and the snapshot needs to be updated.

For more info see tests.

Testing
-------

[](#testing)

```
./vendor/bin/codecept run unit,acceptance
```

If web server needed:

```
./tests/bin/yii serve&
```

Security
--------

[](#security)

If you discover any security related issues, please email [pastukhov\_k@sima-land.ru](mailto:pastukhov_k@sima-land.ru) instead of using the issue tracker.

###  Health Score

33

—

LowBetter than 75% of packages

Maintenance12

Infrequent updates — may be unmaintained

Popularity22

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity72

Established project with proven stability

 Bus Factor1

Top contributor holds 85.9% 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 ~52 days

Recently: every ~162 days

Total

18

Last Release

2500d ago

Major Versions

v1.20 → v2.02017-03-06

v2.0 → v3.02017-09-25

v3.2 → v4.02019-01-10

v4.0 → v5.02019-07-09

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/7937221?v=4)[Pastuhov Kirill](/maintainers/pastuhov)[@pastuhov](https://github.com/pastuhov)

---

Top Contributors

[![pastuhov](https://avatars.githubusercontent.com/u/7937221?v=4)](https://github.com/pastuhov "pastuhov (55 commits)")[![michkarevev](https://avatars.githubusercontent.com/u/37874234?v=4)](https://github.com/michkarevev "michkarevev (8 commits)")[![zloypacifist](https://avatars.githubusercontent.com/u/2009979?v=4)](https://github.com/zloypacifist "zloypacifist (1 commits)")

---

Tags

cicodeceptionsnapshottestingtraceyii2testingdebugdebuggeryii2

###  Code Quality

TestsCodeception

### Embed Badge

![Health badge](/badges/pastuhov-yii2-logstock/health.svg)

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

###  Alternatives

[yiisoft/yii2-debug

The debugger extension for the Yii framework

20323.5M598](/packages/yiisoft-yii2-debug)[guanguans/laravel-soar

SQL optimizer and rewriter for laravel. - laravel 的 SQL 优化器和重写器。

2227.8k](/packages/guanguans-laravel-soar)[vectorface/mysqlite

Select MySQL compatibility functions for PDO's SQLite driver

3639.5k1](/packages/vectorface-mysqlite)[saada/yii2-factory-muffin

A Yii2 wrapper for league/factory-muffin with Gii generators.

1554.6k](/packages/saada-yii2-factory-muffin)

PHPackages © 2026

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