PHPackages                             silly/package - 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. silly/package

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

silly/package
=============

php performance xhprof

17PHP

Since May 28Pushed 7y ago1 watchersCompare

[ Source](https://github.com/HelloMrShu/xhprof)[ Packagist](https://packagist.org/packages/silly/package)[ RSS](/packages/silly-package/feed)WikiDiscussions master Synced 2d ago

READMEChangelogDependenciesVersions (1)Used By (0)

xhprof——PHP performance testing plugin
--------------------------------------

[](#xhprofphp-performance-testing-plugin)

PHP code performance plugin

configuration
-------------

[](#configuration)

### 1. Install xhprof

[](#1-install-xhprof)

**Get source code**

You can get the source code from website , and install on centos 6.5(my machine).

```
cd xhprof-master/extension/
sudo /usr/bin/phpize
sudo ./configure --with-php-config=/usr/bin/php-config --enable-xhprof
sudo make && make install

```

**Load as php extentsion**

You will get the path of xhprof.so, for install /usr/lib64/php/modules/xhprof.so after command make install open the php.ini file by vim,

```
vim /etc/php.ini
extension=/usr/lib64/php/modules/xhprof.so
xhprof.output_dir=/tmp/xhprof // this config is used to analyze the xhprof data

sudo service php-fpm restart

```

you can use php -m | grep xhprof or phpinfo to check whether xhprof is install rightly.

### 2. Config the xhprof-html for nginx visit

[](#2-config-the-xhprof-html-for-nginx-visit)

Config the nginx so that you can visit the xhprof data by table and graph.

```

server {
    listen       13000;
    location  / {
        root           xhprof_html directory path;
        try_files $uri $uri/ /index.php?$query_string;
        fastcgi_pass   127.0.0.1:9000;
        fastcgi_index  index.php;
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_param  SCRIPT_FILENAME   $document_root$fastcgi_script_name;
        include        fastcgi_params;
    }
}

```

### 3. Add xhprof.so and xhprof file output to php.ini

[](#3-add-xhprofso-and-xhprof-file-output-to-phpini)

Add xhprof.so and output destination file to php.ini

```
extension=/usr/lib64/php/modules/xhprof.so
xhprof.output_dir=/tmp/xhprof

```

### 4. How to use the plugin

[](#4-how-to-use-the-plugin)

**Execute the command below**

```
composer require silly/package dev-master

```

then you will find the item in composer.json below require

```
"silly/package": "dev-master"

```

**Use the Xhprof class in your code**

```
use silly\package\Xhprof;
$xf = new Xhprof();

$xh->xhprof_start();

....your code....

$data = $xh->xhprof_end();
$host = 'xxxx/index.php?run='; //the path you visit xhprof_html directory
$xf->xhprof_display($data, $host);

```

Then will print the url, for instance (http://your\_host/index.php?run=5b0c1bf8a8875&amp;source=xhprof), just open it in browser, it will show the data in tablelist and click the \[View Full Callgraph\] link, you will see the function call links. Just care about the links with yellow and red color and optimize them.

**Something useful**

Maybe you have some problem like below.

```
Error: either we can not find profile data for run_id 4d7f0bd99a12f or
the threshold 0.01 is too small or you do not have ‘dot’ image
generation utility installed

```

that's because xhprof draw the png graph, you should upgrate the dot version, just install the graphviz.

```
sudo yum install -y graphviz

```

please make sure the version of graphviz is ok, mine is graphviz-2.26.0 and the graph can be show right.

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity41

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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/74ebf0eb93e19d000139135ccccd3a7a471b14973f82cc1d342e3e1b117fbf98?d=identicon)[HelloMrShu](/maintainers/HelloMrShu)

---

Top Contributors

[![HelloMrShu](https://avatars.githubusercontent.com/u/7631454?v=4)](https://github.com/HelloMrShu "HelloMrShu (21 commits)")

### Embed Badge

![Health badge](/badges/silly-package/health.svg)

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

###  Alternatives

[symfony/stopwatch

Provides a way to profile code

2.8k387.2M918](/packages/symfony-stopwatch)[fruitcake/laravel-debugbar

PHP Debugbar integration for Laravel

19.1k662.9k29](/packages/fruitcake-laravel-debugbar)[spatie/ignition

A beautiful error page for PHP applications.

510147.6M69](/packages/spatie-ignition)[jokkedk/webgrind

Webgrind is a Xdebug profiling web frontend in PHP5. It implements a subset of the features of kcachegrind and installs in seconds and works on all platforms. For quick'n'dirty optimizations it does the job.

3.3k193.0k](/packages/jokkedk-webgrind)[koriym/printo

An object graph visualizer.

1421.8M2](/packages/koriym-printo)[soloterm/dumps

A Laravel command to intercept dumps from your Laravel application.

125285.7k3](/packages/soloterm-dumps)

PHPackages © 2026

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