6

GitHub - yiisoft/yii-debug: Yii debug panel extension

 2 years ago
source link: https://github.com/yiisoft/yii-debug
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Debug Extension for Yii

This extension provides a debugger for Yii framework applications. When this extension is used, a debugger toolbar will appear at the bottom of every page. The extension also provides a set of standalone pages to display more detailed debug information.

For license information check the LICENSE-file.

Installation

The preferred way to install this extension is through composer.

composer require --prefer-dist yiisoft/yii-debug

Usage

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

return [
    'bootstrap' => ['debug'],
    'modules' => [
        'debug' => [
            'class' => Yiisoft\Yii\Debug\Module::class,
            // uncomment and adjust the following to add your IP if you are not connecting from localhost.
            //'allowedIPs' => ['127.0.0.1', '::1'],
        ],
        // ...
    ],
    ...
];

You will see a debugger toolbar showing at the bottom of every page of your application. You can click on the toolbar to see more detailed debug information.

Open Files in IDE

You can create a link to open files in your favorite IDE with this configuration:

return [
    'bootstrap' => ['debug'],
    'modules' => [
        'debug' => [
            'class' => Yiisoft\Yii\Debug\Module::class,
            'traceLine' => '<a href="phpstorm://open?url={file}&line={line}">{file}:{line}</a>',
            // uncomment and adjust the following to add your IP if you are not connecting from localhost.
            //'allowedIPs' => ['127.0.0.1', '::1'],
        ],
        // ...
    ],
    ...
];

You must make some changes to your OS. See these examples:

Virtualized or dockerized

If your application is run under a virtualized or dockerized environment, it is often the case that the application's base path is different inside of the virtual machine or container than on your host machine. For the links work in those situations, you can configure traceLine like this (change the path to your app):

'traceLine' => function($options, $panel) {
    $filePath = str_replace($this->app->basePath, '~/path/to/your/app', $options['file']);
    return strtr('<a href="ide://open?url=file://{file}&line={line}">{text}</a>', ['{file}' => $filePath]);
},

Unit testing

The package is tested with PHPUnit. To run tests:

./vendor/bin/phpunit

Mutation testing

The package tests are checked with Infection mutation framework. To run it:

./vendor/bin/infection

Static analysis

The code is statically analyzed with Psalm. To run static analysis:

./vendor/bin/psalm

Support the project

Follow updates

License

The Debug Extension for Yii is free software. It is released under the terms of the BSD License. Please see LICENSE for more information.

Maintained by Yii Software.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK