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

ActiveSymfony-bundle

cristiansitov/xhprof-bundle
===========================

Symfony JnsXhprofBundle from Jonas Wouters; adaptation by Cristian Sitov

078PHP

Since Sep 11Pushed 13y ago2 watchersCompare

[ Source](https://github.com/CristianSitov/XhprofBundle)[ Packagist](https://packagist.org/packages/cristiansitov/xhprof-bundle)[ RSS](/packages/cristiansitov-xhprof-bundle/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (2)Used By (0)

README
======

[](#readme)

What is XHProf?
---------------

[](#what-is-xhprof)

XHProf is a hierarchical profiler for PHP. It reports function-level call counts and inclusive and exclusive metrics such as wall (elapsed) time, CPU time and memory usage. A function's profile can be broken down by callers or callees. The raw data collection component is implemented in C as a PHP Zend extension called xhprof. XHProf has a simple HTML based user interface (written in PHP). The browser based UI for viewing profiler results makes it easy to view results or to share results with peers. A callgraph image view is also supported.

See [official documentation](http://mirror.facebook.net/facebook/xhprof/doc.html)

What does this Symfony 2 Bundle do?
-----------------------------------

[](#what-does-this-symfony-2-bundle-do)

This bundle helps you to easily use the XHProf bundle with the web debug toolbar in Symfony 2.

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

[](#installation)

Make sure you have XHProf installed. If you are on a mac you can easily install it via [Macports](http://www.macports.org/)sudo port install php5-xhprof

### Get the bundle

[](#get-the-bundle)

To install the bundle, place it in the `src/Jns/Bundle` directory of your project (so that it lives at `src/Jns/Bundle/XhprofBundle`). You can do this by adding the bundle as a submodule, cloning it, or simply downloading the source.

```
git submodule add https://github.com/jonaswouters/XhprofBundle.git src/Jns/Bundle/XhprofBundle

```

### Add the Jns namespace to your autoloader

[](#add-the-jns-namespace-to-your-autoloader)

If this is the first Jns bundle in your Symfony 2 project, you'll need to add the `Jns` namespace to your autoloader. This file is usually located at `app/autoload.php`.

```
$loader->registerNamespaces(array(
    'Jns'                       => __DIR__.'/../src'
    // ...
));

```

### Initializing the bundle

[](#initializing-the-bundle)

To initialize the bundle, you'll need to add it in your kernel. This file is usually located at `app/AppKernel.php`. Loading it only in your dev environment is recommended.

```
public function registerBundles()
{
    // ...

    if (in_array($this->getEnvironment(), array('dev', 'test'))) {
        // ...
        $bundles[] = new Jns\Bundle\XhprofBundle\JnsXhprofBundle();
    }
)

```

### Configure the XHProf locations.

[](#configure-the-xhprof-locations)

The Bundle comes preconfigured for the macports php5-xhprof default installation, with the xhprof web located at . To change these settings for your environment you can override the defaults by defining the following settings in your config. The config is usually located at `app/config/config.yml`.

```
jns_xhprof:
    location_lib:    /opt/local/www/php5-xhprof/xhprof_lib/utils/xhprof_lib.php
    location_runs:   /opt/local/www/php5-xhprof/xhprof_lib/utils/xhprof_runs.php
    location_config: /opt/local/www/php5-xhprof/xhprof_lib/config.php
    location_web:    http://xhprof.localhost
    enabled:         true

```

### Using XHGui

[](#using-xhgui)

[XHGui](https://github.com/preinheimer/xhprof) is a GUI for the XHProf PHP extension, using a database backend, and pretty graphs to make it easy to use and interpret. The XHProf bundle supports using XHGui to display the results. To use, install XHGui, and add the following two settings to the configuration, usually located at `app/config/config.yml`:

```
jns_xhprof:
    entity_manager:   (defaults to default)
    enable_xhgui:    true

```

If you only have one entity manager defined, you don't need to set it here. This setting is for the case where you are using a seperate profiling database for XHGui (highly recommended).

### Specifying a Sample Size

[](#specifying-a-sample-size)

You can specify a sample size for profiling. This is highly suggested for production environments that have plenty of requests. The sample size is set as a probability for profiling, so for example, if you set the sample size to 2, then on average, every second request will be profiled. Of course, in production you want to set it to a much higher value. Defaults to 1, so that every request will be profiled.

```
jns_xhprof:
    sample_size: 2

```

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity43

Maturing project, gaining track record

 Bus Factor3

3 contributors hold 50%+ of commits

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/defbfd1b96542589084e83f2f246a7ce21531f97d2ea49b6e1e0f7f9c18d7e9c?d=identicon)[cristiansitov](/maintainers/cristiansitov)

---

Top Contributors

[![jonaswouters](https://avatars.githubusercontent.com/u/41570?v=4)](https://github.com/jonaswouters "jonaswouters (4 commits)")[![hex337](https://avatars.githubusercontent.com/u/353134?v=4)](https://github.com/hex337 "hex337 (2 commits)")[![sliver](https://avatars.githubusercontent.com/u/6036?v=4)](https://github.com/sliver "sliver (2 commits)")[![nvcristea](https://avatars.githubusercontent.com/u/1607747?v=4)](https://github.com/nvcristea "nvcristea (2 commits)")[![baldurrensch](https://avatars.githubusercontent.com/u/871417?v=4)](https://github.com/baldurrensch "baldurrensch (1 commits)")[![adrienbrault](https://avatars.githubusercontent.com/u/611271?v=4)](https://github.com/adrienbrault "adrienbrault (1 commits)")[![Seldaek](https://avatars.githubusercontent.com/u/183678?v=4)](https://github.com/Seldaek "Seldaek (1 commits)")[![jeremyFreeAgent](https://avatars.githubusercontent.com/u/176363?v=4)](https://github.com/jeremyFreeAgent "jeremyFreeAgent (1 commits)")

### Embed Badge

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

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

PHPackages © 2026

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