pastuhov/yii2-query-tag

Query tag extension for Yii 2

Installs: 3 765

Dependents: 0

Suggesters: 0

Security: 0

Stars: 2

Watchers: 2

Forks: 0

Open Issues: 0

Type:yii2-extension

1.2.0 2017-08-09 19:26 UTC

README

Build Status Scrutinizer Code Quality Code Coverage Total Downloads

Query tag extension for Yii 2

Do you use pgbabger or pg_stat_statements ? And sometimes it can be difficult to understand which code generates the request? yii2-query-tag will help!

Before:

SELECT * FROM page WHERE 1=1

After:

SELECT /* ExampleTest:11 UnitHelper:28 Step:218 */ * FROM page WHERE 1=1

Features

  • Production ready/safe/tested
  • Saves team time

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require --prefer-dist pastuhov/yii2-query-tag

or add

"require-dev": {
    "pastuhov/yii2-query-tag": "~1.1.0"
    ...

to the require section of your composer.json file.

Usage

Change your app config:

    'components' => [
        'db' => [
            'class' => \yii\db\Connection::class,
            'commandClass' => \pastuhov\querytag\Command::class, // <-- add this line

Advanced usage

Extend query tag command class:

namespace app\components;

class Command extends \pastuhov\querytag\Command
{
    public $customTag = 'master';
    public $enabledTags = [
        self::TAG_TYPE_CUSTOM,
        self::TAG_TYPE_TRACE,
    ];
}

Testing

./vendor/bin/codecept run

Security

If you discover any security related issues, please email pastukhov_k@sima-land.ru instead of using the issue tracker.