承接 webware/traccio 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

webware/traccio

Composer 安装命令:

composer require webware/traccio

包简介

Tracy Debugger integration and profiler for Mezzio apps.

README 文档

README

Tracy Debugger integration and profiler for Mezzio applications.

Traccio wires Tracy into a Mezzio middleware pipeline and provides purpose-built debug bar panels for configuration, routes, HTTP requests, and SQL query profiling.

Requirements

Requirement Version
PHP ~8.2 || ~8.3 || ~8.4 || ~8.5
tracy/tracy ^2.11
mezzio/mezzio ^3.26 (dev / host app)

Database profiling additionally requires a PhpDb adapter and the php-db/phpdb package.

Installation

composer require webware/traccio

If you are using the laminas-component-installer plugin it will prompt you to inject the ConfigProvider automatically. Otherwise add it manually (see Configuration).

Configuration

1. Register the ConfigProvider

Add Webware\Traccio\ConfigProvider to your application's config aggregator:

// config/config.php
use Laminas\ConfigAggregator\ConfigAggregator;
use Webware\Traccio\ConfigProvider;

$aggregator = new ConfigAggregator([
    ConfigProvider::class,
    // ... other providers
]);

2. Tracy settings

Create config/autoload/tracy.global.php (or add to an existing autoload file):

use Tracy\Debugger;

return [
    'debug' => true,

    Debugger::class => [
        'dumpTheme'  => 'dark',   // 'light' or 'dark'
        'keysToHide' => [
            'password',
            'pass',
            'secret',
        ],
        // Any public static property of Tracy\Debugger can be set here.
        // 'maxDepth'     => 10,
        // 'maxLength'    => 250,
        // 'showLocation' => true,
    ],
];

Set 'debug' => true or enable Mezzio development mode in config.

Middleware pipeline

Add the two middleware classes to your pipeline. TracyDebuggerMiddleware should come early so it initialises Tracy before your application logic runs. RequestPanelMiddleware should be placed very late in the pipeline so the final state of the Request is reflected in the panel (this is not required for Traccio to work).

// config/pipeline.php
use Webware\Traccio\Middleware\RequestPanelMiddleware;
use Webware\Traccio\Middleware\TracyDebuggerMiddleware;

$app->pipe(TracyDebuggerMiddleware::class);

// ... error handler, routing, ...

$app->pipe(RequestPanelMiddleware::class);

Debug panels

All panels are registered automatically when their dependencies are available in the container. No extra wiring is needed beyond the steps above.

Panel Tracy bar label Shows
ConfigPanel Config Full application config array
RoutesPanel Routes All registered Mezzio routes
RequestPanel Request PSR-7 request headers, method, URI, body
SqlProfilerPanel Database SQL query groups, timings, parameters

SQL Profiler panel

The database panel groups identical queries together and displays:

  • Summary bar — total queries, unique statements, total elapsed, slowest single query (all in ms)
  • Per-group cards — execution count badge, SQL text, total / average timing
  • Per-execution rows — wall-clock start time (H:i:s.mmm), elapsed ms, bound parameters

Parameter tokens reflect the style used in the original query:

Parameter style Displayed token
Positional ? (stored as "0", "1", …) ?1, ?2, …
Named (stored as "C_1", "name", …) :C_1, :name

Enabling database profiling

Database profiling requires:

  1. A PhpDb adapter registered in the container as PhpDb\Adapter\AdapterInterface.
  2. The ProfilingDelegator wrapping that adapter to attach a Profiler instance.

Enable the delegator in your application's config (it is commented out in ConfigProvider by default):

// config/autoload/development.local.php
use PhpDb\Adapter\AdapterInterface;
use Webware\Traccio\PhpDb\ProfilingDelegator;

return [
    'dependencies' => [
        'delegators' => [
            AdapterInterface::class => [
                ProfilingDelegator::class,
            ],
        ],
    ],
];

Once the delegator is active, the SQL panel will appear in the Tracy bar automatically whenever debug is true.

License

BSD-3-Clause — see LICENSE for details.

统计信息

  • 总下载量: 1.33k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 3
  • 依赖项目数: 2
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 2
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: BSD-3-Clause
  • 更新时间: 2026-01-04

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固