PHPackages                             yangweijie/think-debugbar - 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. yangweijie/think-debugbar

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

yangweijie/think-debugbar
=========================

v1.0.7(1y ago)228[1 issues](https://github.com/yangweijie/think-debugbar/issues)Apache-2.0PHP

Since Jun 25Pushed 1y ago1 watchersCompare

[ Source](https://github.com/yangweijie/think-debugbar)[ Packagist](https://packagist.org/packages/yangweijie/think-debugbar)[ RSS](/packages/yangweijie-think-debugbar/feed)WikiDiscussions main Synced today

READMEChangelog (8)Dependencies (2)Versions (9)Used By (0)

think-debugbar
==============

[](#think-debugbar)

用于ThinkPHP6+的[DebugBar](http://phpdebugbar.com/)扩展。

安装
--

[](#安装)

### composer

[](#composer)

```
composer require yangweijie/think-debugbar --dev

```

### .env 修改

[](#env-修改)

```
[debugbar]
DEBUGBAR_ENABLED=true

```

其他配置参考 config/debugbar里的环境变量使用

### nginx

[](#nginx)

nginx 项目的rewrite里要配ThinkPHP的

```
location / {
	index index.php;
	if (!-e $request_filename){
		rewrite  ^(.*)$  /index.php?s=$1  last;
		break;
	}
}

```

静态资源缓存要注释掉

```
#    location ~ .+\.(gif|jpg|jpeg|png|bmp|swf)$
#    {
#        expires      1d;
#        error_log nul;
#        access_log off;
#    }

#    location ~ .+\.(js|css)$
#    {
#        expires      1h;
#        error_log nul;
#        access_log off;
#    }

```

扩展
--

[](#扩展)

### collectors

[](#collectors)

#### 普通

[](#普通)

```
class MyDataCollector extends DebugBar\DataCollector\DataCollector
{
    public function collect()
    {
        return array("uniqid" => uniqid());
    }

    public function getName()
    {
        return 'mycollector';
    }
}
```

```
class MyDataCollector extends DebugBar\DataCollector\DataCollector implements DebugBar\DataCollector\Renderable
{
    // ...

    public function getWidgets()
    {
        return array(
            "mycollector" => array(
                "icon" => "cogs",
                "tooltip" => "uniqid()",
                "map" => "uniqid",
                "default" => "''"
            ),
            "mycollector:badge" => [
                "map" => "SQL.nb_statements",
                "default" => 0
            ]
        );
    }
}

```

badge 角标，可以从collect 取map的key

#### 让message里可以打开指定文件

[](#让message里可以打开指定文件)

如文件加载列表

```
    /**
     * {@inheritDoc}
     */
    public function collect()
    {
        $files = $this->getIncludedFiles();

        $included = [];
        if(!$this->getXdebugLinkTemplate()){
            $this->setEditorLinkTemplate(app()->config->get('debugbar.editor'));
        }
        foreach ($files as $file) {

            if (Str::contains($file, $this->ignored)) {
                continue;
            }

            $included[] = [
                'message'   => "'" . $this->stripBasePath($file) . "',",
                // Use PHP syntax so we can copy-paste to compile config file.
                'is_string' => true,
                'xdebug_link'=>$this->getXdebugLink($file),
            ];
        }

        return [
            'messages' => $included,
            'count'    => count($included),
        ];
    }

```

message 里 包含 xdebug\_link $this-&gt;getXdebugLink($file)

### 资源

[](#资源)

扩展 JavascriptRenderer 类， 实现 renderHead 方法替换静态资源头部 然后 注册路由控制器来实现 资源地址动态返回js文件

升级功能
----

[](#升级功能)

### SQL tab

[](#sql-tab)

将sql 日志 独立出来 显示在SQL tab 里 有timeline、 可以点击跳转编辑器、可以一件复制 [![](https://camo.githubusercontent.com/09a451d8a422db3eec0ef69809854efd4a3b78a1094aa3865a31ace411776c17/68747470733a2f2f63646e2e6a7364656c6976722e6e65742f67682f79616e677765696a69652f7468696e6b2d64656275676261722f73637265656e2f53514c2e706e67)](https://camo.githubusercontent.com/09a451d8a422db3eec0ef69809854efd4a3b78a1094aa3865a31ace411776c17/68747470733a2f2f63646e2e6a7364656c6976722e6e65742f67682f79616e677765696a69652f7468696e6b2d64656275676261722f73637265656e2f53514c2e706e67)

### Ajax 监听

[](#ajax-监听)

支持xhr 请求监听， 可以切换历史请求看调试信息 [![](https://camo.githubusercontent.com/bf4785c7e3b884e7d9070be76dcb30364a53eaf0bd39d03e24ab070cd7477a9c/68747470733a2f2f63646e2e6a7364656c6976722e6e65742f67682f79616e677765696a69652f7468696e6b2d64656275676261722f73637265656e2f616a61782e706e67)](https://camo.githubusercontent.com/bf4785c7e3b884e7d9070be76dcb30364a53eaf0bd39d03e24ab070cd7477a9c/68747470733a2f2f63646e2e6a7364656c6976722e6e65742f67682f79616e677765696a69652f7468696e6b2d64656275676261722f73637265656e2f616a61782e706e67)

### 添加模型显示

[](#添加模型显示)

显示请求中使用的模型 可以打开跳转

### 加载文件可以打开跳转源文件

[](#加载文件可以打开跳转源文件)

### tab 中文化

[](#tab-中文化)

### logo显示官方logo

[](#logo显示官方logo)

编辑器、ide 打开方式
------------

[](#编辑器ide-打开方式)

### sublime

[](#sublime)

需要安装 GitHub - [thecotne/subl-protocol: sublime text protocol](https://github.com/thecotne/subl-protocol) 插件

### phpstorm

[](#phpstorm)

参考 [laravel-debugbar 中正确使用 ide phpstorm 打开项目文件的方式 | Laravel China 社区](https://learnku.com/articles/77072) 文章放置 js 和 添加注册表即可

###  Health Score

24

—

LowBetter than 31% of packages

Maintenance24

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity46

Maturing project, gaining track record

 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.

###  Release Activity

Cadence

Every ~12 days

Recently: every ~20 days

Total

8

Last Release

651d ago

### Community

Maintainers

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

---

Top Contributors

[![yangweijie](https://avatars.githubusercontent.com/u/1614114?v=4)](https://github.com/yangweijie "yangweijie (27 commits)")

### Embed Badge

![Health badge](/badges/yangweijie-think-debugbar/health.svg)

```
[![Health](https://phpackages.com/badges/yangweijie-think-debugbar/health.svg)](https://phpackages.com/packages/yangweijie-think-debugbar)
```

###  Alternatives

[snowair/phalcon-debugbar

Integrates PHP Debug Bar with Phalcon.

159125.9k1](/packages/snowair-phalcon-debugbar)[yusukezzz/slim-debugbar

4214.1k1](/packages/yusukezzz-slim-debugbar)[xiaodi/think-whoops

A debug service for ThinkPHP.

393.6k1](/packages/xiaodi-think-whoops)

PHPackages © 2026

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