PHPackages                             beastbytes/yii-tracy - 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. [Debugging &amp; Profiling](/categories/debugging)
4. /
5. beastbytes/yii-tracy

ActiveLibrary[Debugging &amp; Profiling](/categories/debugging)

beastbytes/yii-tracy
====================

Integrate the Tracy debugger into the Yii Framework

066PHP

Since Oct 15Pushed 8mo ago1 watchersCompare

[ Source](https://github.com/beastbytes/yii-tracy)[ Packagist](https://packagist.org/packages/beastbytes/yii-tracy)[ RSS](/packages/beastbytes-yii-tracy/feed)WikiDiscussions main Synced 3w ago

READMEChangelogDependenciesVersions (1)Used By (0)

The Yii Tracy package integrates the [Tracy debugging tool](https://tracy.nette.org/)into [Yii3](https://www.yiiframework.com/).

Requirements
------------

[](#requirements)

- PHP 8.1 or higher

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

[](#installation)

Do not directly install this package.

Install the [Yii Tracy Panels](#panels) as required.

Configuration
-------------

[](#configuration)

Yii Tracy is configured using Yii’s configuration. It has the following configuration parameters defined in the `beastbytes/yii-tracy` section of `params-web.php`:

- editor (string) [Tracy IDE integration](https://tracy.nette.org/en/open-files-in-ide)
- email (null|string|string\[\]) Email address(es) to which send error notifications
- logDirectory (?string) Absolute path or path alias to the log directory. Default: `'@runtime/logs'`
- logSeverity (int) Log bluescreen in production mode for this error severity.
- mode (null|bool|string|array) The mode that Tracy is to operate in; Development or Production.
    - `Tracy\Debugger::Detect`: Tracy detects the mode; it sets ***development mode*** is if it is running on *localhost*(i.e. IP address 127.0.0.1 or ::1) and there is no proxy, otherwise it sets ***production mode***.
    - `Tracy\Debugger::Development`: put Tracy in ***development mode***.
    - `Tracy\Debugger::Production`: put Tracy in ***production mode***.
    - string: enable ***development mode*** for the given IP address.
    - string\[\]: enable ***development mode*** for IP addresses in the list.

        **NOTE** It is highly recommended to combine IP addresses with a cookie token by specifying allowed addresses as `@`; see *token*.
- panelConfig (array) Panel configurations indexed by panel ID. Panel packages contain default configuration.
- panels (string\[\]) IDs of panels to show. The panels are added to the debugger in the order listed.
- showBar (bool) Whether to display debug bar in ***development mode***.
- token (string) The secret token for enabling ***development mode*** for IP addresses. See *mode*.

***Note***: A panel must be configured in `panelConfig` and listed in `panels` to be enabled.

Set the required configuration parameters in the application `params-web` configuration file.

Internationalisation
--------------------

[](#internationalisation)

Yii Tracy supports internationalisation of tabs and panels. To ensure that this works as expected an implementation of `Yiisoft\Translator\TranslatorInteface`must be present in application views.

Disable Yii Debug
-----------------

[](#disable-yii-debug)

Yii Tracy uses components of Yii Debug; to ensure Yii Tracy operates correctly, it is necessary to disable Yii Debug.

In the application entry script, set the `configModifiers` parameter in the constructor of the application runner; the value is:

```
[
    RemoveFromVendor::groups([
        'yiisoft/yii-debug' => '*',
    ]),
]
```

The end of the application entry script will be something like:

```
(new HttpApplicationRunner(
    rootPath: ,
    debug: ,
    checkEvents: ,
    environment: ,
    configModifiers: [
        RemoveFromVendor::groups([
            'yiisoft/yii-debug' => '*',
        ]),
    ],
))->run();
```

Panels
------

[](#panels)

The following panels are available:

- [Assets](https://github.com/beastbytes/yii-tracy-panel-assets) Provides information about Asset Bundles on the page.
- [Database](https://github.com/beastbytes/yii-tracy-panel-database) Provides information about the database connection and executed queries.
- [Route](https://github.com/beastbytes/yii-tracy-panel-route) Provides information about the current route.
- [User](https://github.com/beastbytes/yii-tracy-panel-user) Provides information about the current user.
- [View](https://github.com/beastbytes/yii-tracy-panel-view) Provides information about the rendered view.

Add the required panels to the `require-dev` section of the application `composer.json`. This package is installed as a dependency.

### Custom Panels

[](#custom-panels)

Custom panels can be added to Yii Tracy. The information below gives details of how to do this. Also see [Tracy Bar Extensions](https://tracy.nette.org/en/extensions) for more information and examine the existing panels for example code.

#### Panel Class

[](#panel-class)

The Panel class must extend either `BeastBytes\Yii\Tracy\Panel\Panel`or one of the collector panel classes if the panel uses a `Yiisoft\Yii\Debug\Collector\CollectorInterface`.

All panels have access to Yii's Dependency Injection container through the `$container` property.

The Panel class must implement the following methods:

##### getViewPath(): string

[](#getviewpath-string)

**Visibility**: *public*

Returns the view path.

BeastBytes\\Yii\\Tracy\\ViewTrait provides this method for panels that follow the standard file structure.

##### panelParameters(): array

[](#panelparameters-array)

**Visibility**: *protected*

Returns view parameters for the panel view as array&lt;string: mixed&gt;;

##### panelTitle(): array

[](#paneltitle-array)

**Visibility**: *protected*

Returns array{id: string, category: int} where:

- id: message id for translation
- category: message translation category

***Tip*** Define a public constant `MESSAGE_CATEGORY = tracy-`

##### tabIcon(array $parameters): string

[](#tabiconarray-parameters-string)

**Visibility**: *protected*

Returns an SVG icon for the debugger tab view.

The method takes the tab parameters as an argument to allow the icon to reflect the state of the tab.

#### tabParameters(): array

[](#tabparameters-array)

**Visibility**: *protected*

Returns view parameters for the debugger tab view as array&lt;string: mixed&gt;;

##### tabTitle(): array

[](#tabtitle-array)

**Visibility**: *protected*

Returns array{id: string, category: int} where:

- id: message id for translation
- category: message translation category

***Tip*** Define a public constant `MESSAGE_CATEGORY = tracy-`

#### Views

[](#views)

The panel must implement two views, *tab* and *panel*; they are *php* templates. The views need only render the tab/panel content; Yii Tracy provides layouts for both tab and panel to decorate the content.

To correctly support internationalisation and make the panel fully contained, it is recommended to:

- Define a public constant in the Panel class that defines the message translation category

```
public const MESSAGE_CATEGORY = 'tracy-';
```

where `` is the panel id, and the prefix `tracy-` avoids name collisions

- Place the following line at the start of the tab and panel views:

```
$translator = $translator->withDefaultCategory(Panel::MESSAGE_CATEGORY);
```

- Use message ids of the form `.type.name`. Suggested *types* are 'heading', 'title', 'value'. `type` can be omitted for body text.

#### Configuration

[](#configuration-1)

Two configuration files are required:

- di-web.php - defines the message translation category
- params-web - defines the panel

and references to them in `composer.json`.

##### di-web.php

[](#di-webphp)

```
use Fully\Qualified\Namespace\For\Panel;
use Yiisoft\Translator\CategorySource;
use Yiisoft\Translator\IntlMessageFormatter;
use Yiisoft\Translator\Message\Php\MessageSource;

$category = Panel::MESSAGE_CATEGORY;
$messageSource = dirname(__DIR__) . '/resources/messages';

return [
    "translation.$category" => [
        'definition' => static function() use ($category, $messageSource)  {
            return new CategorySource(
                $category,
                new MessageSource($messageSource),
                new IntlMessageFormatter(),
            );
        },
        'tags' => ['translation.categorySource'],
    ],
];
```

##### params-web.php

[](#params-webphp)

```
return [
    'beastbytes/yii-tracy' => [
        'panelConfig' => [
            '' => [
                'class' => ,
                // Additional panel definition
            ],
        ],
    ],
];
```

##### composer.json

[](#composerjson)

Add references to `di-web.php` and `params.php` in the `extra` section of `composer.json`:

```
  "extra": {
    // Additional 'extra' sections
    "config-plugin": {
      "di-web": "di-web.php",
      "params-web": "params-web.php"
    }
  }
```

License
-------

[](#license)

The BeastBytes Yii Tracy package is free software. It is released under the terms of the BSD License. Please see [`LICENSE`](./LICENSE.md) for more information.

###  Health Score

18

—

LowBetter than 8% of packages

Maintenance43

Moderate activity, may be stable

Popularity8

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity13

Early-stage or recently created project

 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/b0b5133b5137b26eeb25056449c28364ac0af31836eefba78912a9c8f0743aa3?d=identicon)[BeastBytes](/maintainers/BeastBytes)

---

Top Contributors

[![beastbytes](https://avatars.githubusercontent.com/u/1470144?v=4)](https://github.com/beastbytes "beastbytes (73 commits)")

### Embed Badge

![Health badge](/badges/beastbytes-yii-tracy/health.svg)

```
[![Health](https://phpackages.com/badges/beastbytes-yii-tracy/health.svg)](https://phpackages.com/packages/beastbytes-yii-tracy)
```

###  Alternatives

[jkocik/laravel-profiler

Profiler for Laravel Framework

189601.1k](/packages/jkocik-laravel-profiler)[fjogeleit/prometheus-messenger-middleware

Prometheus Middleware for the Symfony Messenger Component

2255.2k](/packages/fjogeleit-prometheus-messenger-middleware)[spatie/craft-ray

Easily debug CraftCMS projects

1638.4k](/packages/spatie-craft-ray)

PHPackages © 2026

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