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

ActiveLibrary

pshentsoff/xhgui-collector
==========================

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

1.8.1(5y ago)081MITPHPPHP &gt;=5.3.0

Since Apr 10Pushed 5y agoCompare

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

READMEChangelogDependencies (1)Versions (18)Used By (1)

[![Build Status](https://camo.githubusercontent.com/707b70301d6b3812d6b0b148e8dd77f665c906df42182587d0cc940106cb78f8/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f707368656e74736f66662f78686775692d636f6c6c6563746f722f6261646765732f6275696c642e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/pshentsoff/xhgui-collector/build-status/master)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/4107eb24d8b9feec077ee49b82aaaa26db85a3171fed6511a3f0e5f7c592217d/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f707368656e74736f66662f78686775692d636f6c6c6563746f722f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/pshentsoff/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
- Possibility to prepare profile before saving to database.
- Replacing dots at profile keys for compatibility with latest MongoDB versions according to [this](https://docs.mongodb.com/manual/reference/limits/#Restrictions-on-Field-Names) restrictions.

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:

```
