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

AbandonedArchivedYii-extension[Debugging &amp; Profiling](/categories/debugging)

stevad/yii-xhprof
=================

Yii extension to profile application with Facebook XHProf

v0.1.1(10y ago)06.4k11BSD-3-ClausePHPPHP &gt;=5.3.0

Since Oct 16Pushed 7mo ago2 watchersCompare

[ Source](https://github.com/Stevad/yii-xhprof)[ Packagist](https://packagist.org/packages/stevad/yii-xhprof)[ Docs](https://github.com/stevad/yii-xhprof)[ RSS](/packages/stevad-yii-xhprof/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (2)Dependencies (2)Versions (3)Used By (1)

yii-xhprof
==========

[](#yii-xhprof)

Warning

This repository is not maintained anymore!

Simple extension to use XHProf with Yii Framework 1.x.

Can work together with [yii2-debug](https://github.com/zhuravljov/yii2-debug) extension (bundled with debug panel for it).

By default profile starts on `onBeginRequest` event and stops on `onEndRequest` event. You can change this behavior and manually start and stop profiler.

For license information check the [LICENSE](LICENSE.md) file.

Tested on Yii Framework v1.1.16.

Installation
------------

[](#installation)

This extension is available at packagist.org and can be installed via composer by following command:

`composer require --dev stevad/yii-xhprof`.

If you want to install this extension manually - copy sources to `/protected/extensions` directory.

Minimal configuration to enable profiler:

```
return array(
    'preload' => array(
        'xhprof'
    ),
    'components' => array(
        'xhprof' => array(
            'class' => 'ext.yii-xhprof.XHProfComponent', // if you install to protected/extensions
            'libPath' => '/full/path/to/xhprof_lib',
            'htmlReportBaseUrl' => 'http://url.path.to/xhprof_html',
        ),
    ),
);
```

If you want to add bundled debug panel to [yii2-debug](https://github.com/zhuravljov/yii2-debug) extension - update configuration next way:

```
return array(
    'components' => array(
        'debug' => array(
            // ... other debug config options ...
            'panels' => array(
                'xhprof' => array(
                    'class' => 'ext.yii-xhprof.XHProfPanel' // if you install to protected/extensions
                )
            )
        ),
    ),
);
```

Required XHProf files (library files - `xhprof_lib` and UI - `xhprof_html`) you can find in this [GitHub repo](https://github.com/phacility/xhprof).

Component configuration
-----------------------

[](#component-configuration)

Extension provide next configuration options for Yii component:

- `enabled` - enable/disable profiler component.
- `reportPathAlias` - path alias to the directory to store JSON file with previous profiler runs. Default: `application.runtime.xhprof`
- `maxReportsCount` - number of profile reports to store. Default: `25`.
- `manualStart` - flag to manually start profiler from desired place. Default: `false`.
- `manualStop` - flag to manually stop profiler from desired place. Default: `false`.
- `forceStop` - flag to force stop profiler on `onEndRequest` event if `manualStop` is enabled and profiler is still running. Default: `true`.
- `triggerGetParam` - name of the GET param to manually trigger profiler to start. Default: no value, profiler runs on each request.
- `showOverlay` - flag to display overlay on page with links to report and callgraph result for current profiler run (if allowed). Not required to be `true` if you are using bundled panel for yii2-debug extension. Default: `true`.
- `libPathAlias ` - path alias to the directory with `xhprof_lib` contents if it is placed somewhere in your Yii project. This option has more priority than `libPath`.
- `libPath` - direct filesystem path to the directory with `xhprof_lib` contents.
- `htmlReportBaseUrl` - URL path to the directory with XHProf UI contents (`xhprof_html`). Default: `/xhprof_html` (assuming you have this folder inside your document root).
- `flagNoBuiltins` - enable/disable XHPROF\_FLAGS\_NO\_BUILTINS flag for profiler ([XHProf constants](http://php.net/manual/xhprof.constants.php)). Default: `true`.
- `flagCpu` - enable/disable XHPROF\_FLAGS\_CPU flag for profiler ([XHProf constants](http://php.net/manual/xhprof.constants.php)). Default: `false`.
- `flagMemory` - enable/disable XHPROF\_FLAGS\_MEMORY flag for profiler ([XHProf constants](http://php.net/manual/xhprof.constants.php)). Default: `true`.
- `blacklistedRoutes` - list of routes which profiler should ignore. Allowed wildcard `*` which means 'any alphanumeric value and one of this: `/`, `.`, `_`, `-`. Default: `array('debug*')` (to ignore requests to the debug extension pages).

XHProf class configuration
--------------------------

[](#xhprof-class-configuration)

Component from extension use own developed simple wrapper for `xhprof_enable` / `xhprof_disable` functions: [XHProf](XHProf.php) class. This class provide functionality to start/stop profiling, save reports and get URLs for reports with XHProf library by Facebook.

Available configuration options (applicable for `configure` method, see example below):

- `flagNoBuiltins` - enable/disable XHPROF\_FLAGS\_NO\_BUILTINS flag for profiler ([XHProf constants](http://php.net/manual/xhprof.constants.php)). Default: `true`.
- `flagCpu` - enable/disable XHPROF\_FLAGS\_CPU flag for profiler ([XHProf constants](http://php.net/manual/xhprof.constants.php)). Default: `false`.
- `flagMemory` - enable/disable XHPROF\_FLAGS\_MEMORY flag for profiler ([XHProf constants](http://php.net/manual/xhprof.constants.php)). Default: `true`.
- `libPath` - direct filesystem path to the directory with `xhprof_lib` contents.
- `htmlUrlPath` - URL path to the directory with XHProf UI contents (`xhprof_html`).
- `runId` - predefined value of identifier for current profiler run.
- `runNamespace` - predefined value of namespace for current profiler run.

All options can be changed with setters (e.g. `setFlagCpu()`). For more details see the source code of the class.

Manual profiling
----------------

[](#manual-profiling)

If you enable manual start (`manualStart` option) or stop (`manualStop` option) you can place code to start/stop profiler in any place of your code and be able to see report and callgraph result.

To manual start you need to write some kind of next code:

```
// create and configure instance of XHProf class
XHProf::getInstance()->configure(array(
    'flagNoBuiltins' => true,
    'flagCpu' => false,
    'flagMemory' => true,
    'runNamespace' => 'my-cool-namespace',
    'libPath' => '/var/www/html/xhprof/xhprof_lib',
    'htmlUrlPath' => 'http://test.local/xhprof/xhprof_html'
));

// start profiler
XHProf::getInstance()->run();
```

To manual stop you need to write next code:

```
// stop profiler
XHProf::getInstance()->stop();
```

*Note:* If you use `XHProf` class (with or without this extension) - all profile results can be found on XHProf UI page (it's by default by xhprof developers).

Author
------

[](#author)

Copyright (c) 2015 by Stevad.

###  Health Score

33

—

LowBetter than 75% of packages

Maintenance44

Moderate activity, may be stable

Popularity19

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity49

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 85.7% 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 ~0 days

Total

2

Last Release

3867d ago

### Community

Maintainers

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

---

Top Contributors

[![Stevad](https://avatars.githubusercontent.com/u/9192085?v=4)](https://github.com/Stevad "Stevad (6 commits)")[![tankist](https://avatars.githubusercontent.com/u/454477?v=4)](https://github.com/tankist "tankist (1 commits)")

---

Tags

debugprofilingextensionyiixhprof

### Embed Badge

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

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

###  Alternatives

[zhuravljov/yii2-debug

Yii debug toolbar

144501.1k4](/packages/zhuravljov-yii2-debug)[laracraft-tech/laravel-xhprof

Easy XHProf setup to profile your laravel application!

235321.4k](/packages/laracraft-tech-laravel-xhprof)[renan/cakephp-xhprof

Plugin that quickly enables XHProf profiling for your CakePHP application.

2138.7k](/packages/renan-cakephp-xhprof)[bavix/laravel-xhprof

Quick profiling of your code for Laravel

22156.6k](/packages/bavix-laravel-xhprof)[georgringer/backend-debug

Some debug helper for the TYPO3 backend

2032.4k1](/packages/georgringer-backend-debug)

PHPackages © 2026

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