PHPackages                             phpxxb/xhprof - 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. phpxxb/xhprof

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

phpxxb/xhprof
=============

XHProf is a function-level hierarchical profiler for PHP

12252PHP

Since Apr 6Pushed 4y ago1 watchersCompare

[ Source](https://github.com/xiexianbo123/xhprof)[ Packagist](https://packagist.org/packages/phpxxb/xhprof)[ RSS](/packages/phpxxb-xhprof/feed)WikiDiscussions dev Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

Xhprof
======

[](#xhprof)

概述
--

[](#概述)

「Xhprof」是为了在生产环境中使用而打造的。它对性能的影响最小，同时收集足够的信息用于诊断性能问题。

运行环境
----

[](#运行环境)

- PHP 7.0+
- xhprof extension
- redis extension

安装方法
----

[](#安装方法)

通过composer管理您的项目依赖，可以在你的项目根目录运行：

```
$ composer require phpxxb/xhprof

```

快速使用
----

[](#快速使用)

### 常用方法

[](#常用方法)

方法名解释Xhprof\\Xhprof\\index()页面输出方法，用于展示xhprof搜集到的运行信息Xhprof\\Xhprof\\xhprofStart()开启监听方法，用于处理数据的收集、存储、加工等### 使用示例(laravel框架/TP5框架)

[](#使用示例laravel框架tp5框架)

1.php安装`redis`、`xhprof`扩展

2.执行`composer require phpxxb/xhprof`下载依赖的库

3.拷贝所需样式文件到「公共目录」

```
cp -r ./vendor/phpxxb/xhprof/src/xhprof/xhprof_html  ./public

```

4.代码层，Xhprof开启监听，可放基础控制器中

```
public function __construct()
{
    $config = [
        'ui_dir_url_path' => '/xhprof_html'
    ];
    $xhprof = new \Xhprof\Xhprof($config);
    $xhprof->xhprofStart();
}

```

5.定义路由，展示结果页面

```
Route::get("xhprof", function (){
    $config = [
        'ui_dir_url_path' => '/xhprof_html'
    ];
    $xhprof = new \Xhprof\Xhprof($config);
    $xhprof->index();
});

```

6.浏览器打开地址看效果

[![image](./doc/demo.jpg)](./doc/demo.jpg)

### 配置参考

[](#配置参考)

```
ui_dir_url_path     xhprof_html目录的路径，需配合cp命令
redis_host          redis主机(默认：localhost)
redis_port          redis端口(默认：6379)
redis_pwd           redis端口(默认为空)
redis_db            redis数据库(默认：0)
key_prefix          redis存储数据的前缀(默认：xhprof)
time_limit          请求超过多少秒开始记录(默认：0，记录所有)
log_num             保留最近的多少条记录(默认：1000，保留1000条记录)
view_wtred          列表页面超过多少秒标红(默认：3，请求耗时超过3秒标红)
ignore_url_arr      需忽略不作为统计的请求。

```

License
-------

[](#license)

- MIT

联系我们
----

[](#联系我们)

邮箱：

###  Health Score

19

—

LowBetter than 9% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity27

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/387803fb91d47bda5add2b01382a94c16e626f3afb3b5d8a252ef99434646edc?d=identicon)[phpxxb](/maintainers/phpxxb)

---

Top Contributors

[![xiexianbo123](https://avatars.githubusercontent.com/u/15534161?v=4)](https://github.com/xiexianbo123 "xiexianbo123 (17 commits)")

### Embed Badge

![Health badge](/badges/phpxxb-xhprof/health.svg)

```
[![Health](https://phpackages.com/badges/phpxxb-xhprof/health.svg)](https://phpackages.com/packages/phpxxb-xhprof)
```

###  Alternatives

[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.6k](/packages/spatie-craft-ray)

PHPackages © 2026

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