PHPackages                             aaron-dev/xhprof-webman - 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. aaron-dev/xhprof-webman

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

aaron-dev/xhprof-webman
=======================

aaron-dev/xhprof-webman is a code performance analysis plugin compatible with webman, Laravel, ThinkPHP and Hyperf. Uses xhprof extension for profiling, Redis for storage, provides browser-based performance analysis reports.

v3.0.1(1mo ago)5502↑140%3[1 issues](https://github.com/erikwang2013/xhprof-webman/issues)[1 PRs](https://github.com/erikwang2013/xhprof-webman/pulls)MITPHPPHP &gt;=8.0

Since Oct 27Pushed 1mo agoCompare

[ Source](https://github.com/erikwang2013/xhprof-webman)[ Packagist](https://packagist.org/packages/aaron-dev/xhprof-webman)[ RSS](/packages/aaron-dev-xhprof-webman/feed)WikiDiscussions main Synced yesterday

READMEChangelog (7)Dependencies (5)Versions (12)Used By (0)

XHProf 性能分析插件
=============

[](#xhprof-性能分析插件)

兼容 webman / Laravel / ThinkPHP / Hyperf 的代码性能分析插件。

基于 xhprof 扩展采集数据并存入 Redis，开发者可通过浏览器快速访问性能分析报告，排查代码性能瓶颈。

环境要求
----

[](#环境要求)

- PHP &gt;= 8.0
- xhprof 扩展
- redis 扩展
- Redis 服务

安装
--

[](#安装)

php.ini 中增加 xhprof 配置：

```
[xhprof]
extension=xhprof.so
xhprof.output_dir=/tmp/xhprof
```

Composer 安装：

```
composer require aaron-dev/xhprof-webman
```

---

框架配置
----

[](#框架配置)

### Webman

[](#webman)

**1. 注册全局中间件** — `config/middleware.php`：

```
return [
    '' => [
        ErikWang2013\Xhprof\Webman\XhprofMiddleware::class,
    ],
];
```

**2. 创建控制器**：

```
