PHPackages                             tinson/xhgui-collector - 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. tinson/xhgui-collector

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

tinson/xhgui-collector
======================

Library for collecting and storing XHProf results for later use by XHGUI.

1.8.1(6y ago)06MITPHPPHP &gt;=5.3.0

Since Apr 10Pushed 6y agoCompare

[ Source](https://github.com/hetiansu5/xhgui-collector)[ Packagist](https://packagist.org/packages/tinson/xhgui-collector)[ RSS](/packages/tinson-xhgui-collector/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (2)Versions (16)Used By (0)

[![Build Status](https://camo.githubusercontent.com/7d3a9b23149fa54ec7ea24c45f60fe28a9ffccf9e097bb310baccbe0520f5ea8/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f70657266746f6f6c732f78686775692d636f6c6c6563746f722f6261646765732f6275696c642e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/perftools/xhgui-collector/build-status/master)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/1e12e0ace81b361b671f157e1a2cabbcbb4700dc61647b3b43090459d169059e/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f70657266746f6f6c732f78686775692d636f6c6c6563746f722f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/perftools/xhgui-collector/?branch=master)

XHGUI Collector
===============

[](#xhgui-collector)

This is a small standalone module which you can use to collect and store [XHProf](https://pecl.php.net/package/xhprof) performance data for later usage in [XHGUI](https://github.com/perftools/xhgui).

Goals
-----

[](#goals)

- Compatibility with PHP &gt;= 5.3.0
- No dependencies aside from the relevant extensions
- Customizable and configurable so you can build your own logic on top of it

XHGUI Compatibility
-------------------

[](#xhgui-compatibility)

This project was originally forked from [perftools/xhgui@133051f](https://github.com/perftools/xhgui/commit/133051f0c27240adadf00eadc236be595caadcdd), which was after the tag 0.7.1.

This should ensure compatibility for most tags up to 0.7.1 (included).

The only change that would break compatibility would be a schema change on the XHGUI side.

This table represents current known information about compatibility between this project and [XHGUI](https://github.com/perftools/xhgui) data schema.

XHGUI Collector versionXHGUI VersionCompatibility1.0.0 - 1.x0.2.0 - 0.9.0presumed compatible - no schema changesUsage
-----

[](#usage)

### Profile an Application or Site

[](#profile-an-application-or-site)

The simplest way to profile an application is to use `external/header.php`. `external/header.php` is designed to be combined with PHP's [auto\_prepend\_file](http://www.php.net/manual/en/ini.core.php#ini.auto-prepend-file) directive. You can enable `auto_prepend_file` system-wide through `php.ini`. Alternatively, you can enable `auto_prepend_file` per virtual host.

With apache this would look like:

```

  php_admin_value auto_prepend_file "/Users/markstory/Sites/xhgui/external/header.php"
  DocumentRoot "/Users/markstory/Sites/awesome-thing/app/webroot/"
  ServerName site.localhost

```

With Nginx in fastcgi mode you could use:

```
server {
  listen 80;
  server_name site.localhost;
  root /Users/markstory/Sites/awesome-thing/app/webroot/;
  fastcgi_param PHP_VALUE "auto_prepend_file=/Users/markstory/Sites/xhgui/external/header.php";
}
```

### Profile a CLI Script

[](#profile-a-cli-script)

The simplest way to profile a CLI is to use `external/header.php`. `external/header.php` is designed to be combined with PHP's [auto\_prepend\_file](http://www.php.net/manual/en/ini.core.php#ini.auto-prepend-file) directive. You can enable `auto_prepend_file` system-wide through `php.ini`. Alternatively, you can enable include the `header.php` at the top of your script:

```
