forrest79/tracy-remotebar
Composer 安装命令:
composer require forrest79/tracy-remotebar
包简介
Show Tracy bars from API, cli or classic web requests on a separate remote client.
README 文档
README
Introduction
Remote bar renders Tracy bars not to a web page but to a separate browser tab or Chrome Dev tab.
Benefits:
- you can see Tracy bar from non-HTML request (API)
- you can see Tracy bar for cli (even tests)
- you can see old Tracy bar
- exceptions in AJAX calls are also rendered remotely, and you can still use the source page without refreshing it
Watch the video how remote bars work on YouTube
Comments, bug reports, PRs and ideas are welcome!
Installation
To use this extension, require it in Composer:
composer require --dev forrest79/tracy-remotebar
Use this extension only in your DEV environment! Using in a production environment is possible, but at your own risk.
How does it work?
Remote bars uses a running standalone HTTP server that collects bars and also have a simple HTML interface to show them.
Classic Tracy can't handle this, so there is a little bit of hacking (to use private functions) and code coping from the original Tracy.
By enabling this extension, bars on the original Tracy are disabled. Then bar HTML is collected in the separated shutdown handler and send to the server where it is saved to the file and simple client loads HTML this files, and renders it to the separate iframes.
This package should only be in the require-dev section, so on the production, you still have the original Tracy.
There is created directory
tracy-remote-barin your system temp directory, where the HTML is saved.
How to use it?
There must be server running. You can use PHP internal HTTP server via vendor/bin/run-tracy-remote-bar-server [port=7979] [ip=0.0.0.0]
(this will run server on all interfaces on port 7979 - to see the bars, open http://127.0.0.1:7979) or you can create nginx/Apache virtual
host pointed to src/Server/public.
This is the sample configuration for nginx:
server {
listen 80;
server_name tracy.test;
root <...>/vendor/forrest79/tracy-remotebar/src/Server/public;
index index.php;
client_max_body_size 100M;
location / {
try_files $uri $uri/ /index.php$is_args$args;
}
location ~* \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass 127.0.0.1:9000;
fastcgi_param DOCUMENT_ROOT $document_root;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
}
client_max_body_sizeis important, bar HTML code is sending via POST method in body, and the HTML can be big
Use the correct path in the root. You need also host tracy.test pointing to your server, and then you can open in your browser http://tracy.test.
In your application DI configuration, add this:
extensions: tracyRemoteBar: Forrest79\TracyRemoteBar\Bridges\Nette\TracyRemoteBarExtension tracyRemoteBar: enabled: true # default is false serverUrl: http://127.0.0.1:7979 # or http://tracy.test or null #curlConnectTimeout: 1 # default value #curlTimeout: 1 # default value
If you're running your app and Tracy RemoveBar server on the same "filesystem", you can set
serverUrlto null and then bars are directly saved to the data file and not transmitted via local network.
And that's it. Refresh your app page or run something from the cli, and you should see bar in the client page.
If not, there is a log file tracy-remote-bar.log in your logs directory (if it's set on Tracy\Debugger::logsDir, otherwise simple echo is used), where you can see what goes wrong.
You can also activate remote rendering manually:
Forrest79\TracyRemoteBar\Remote::register('http://127.0.0.1:7979'); // or http://tracy.test // optionally pass cURL timeouts as 2nd and 3rd argument (connect timeout, timeout) Forrest79\TracyRemoteBar\Remote::register('http://127.0.0.1:7979', 2, 5);
Tracy\Debuggermust be enabled beforeForrest79\TracyRemoteBar\Remote::register()is called, otherwise registration is ignored.
And there are also some useful methods:
Forrest79\TracyRemoteBar\Remote::enable(); // re-enable remote bar (e.g. after calling disable()) Forrest79\TracyRemoteBar\Remote::disable(); // disable remote bar and restore the standard Tracy bar - can be called and reversed multiple times during one request Forrest79\TracyRemoteBar\Remote::dispatchBars(); // this is usefull for long running services in cli - calling this immediately send bars to the server and you can do it many times during one execution (just be aware that some bars can grow because they are not reset)
Developer extension
There is a simple developer extension (tested in Chrome):
- open
Manage extensions - activate developer mode
- click
Load unpacked - choose
vendor/forrest79/tracy-remotebar/chrome-dev-panel
Now you have a new tab in your developer tools. In the settings, enter the correct server URL.
Example app
In this repository (not in the package installed via composer) is a simple example application where you can test everything this package can handle.
Run composer update in example/app directory (this probably won't run on Windows, because of symlinks).
Use internal PHP HTTP server via example/run-app [port=8000] [ip=0.0.0.0] or create nginx/Apache virtual host:
Sample nginx configuration for host tracy.app.test (use the correct root path):
server {
listen 80;
server_name tracy.app.test;
root <...>/example/app/public;
location / {
try_files $uri $uri/ /index.php$is_args$args;
}
location ~* \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass 127.0.0.1:9000;
fastcgi_param DOCUMENT_ROOT $document_root;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
}
Default server URL is http://127.0.0.1:7979, to change it, create file example/app/config/local.neon with:
parameters: remoteServerUrl: http://tracy.test
forrest79/tracy-remotebar 适用场景与选型建议
forrest79/tracy-remotebar 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 70 次下载、GitHub Stars 达 2, 最近一次更新时间为 2025 年 01 月 03 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「remote」 「bar」 「tracy」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 forrest79/tracy-remotebar 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 forrest79/tracy-remotebar 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 forrest79/tracy-remotebar 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Bar with versions list of vendor libraries for Tracy
Simple PHP chart drawing library
This bundle lets you use the Tracy's debug screen in combination with the the default profiler in your Symfony application.
Allow packages to be installed from a repository or tarball bundle that have multiple packages in the sub-folders
A panel for Tracy Debugger in an ATK14 project. Displays nested list of all rendered templates.
A fork of runcmf/runtracy
统计信息
- 总下载量: 70
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 23
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: BSD-3-Clause
- 更新时间: 2025-01-03
