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

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

phpperftools/collector
======================

Library for collecting and storing XHProf/uprofiler/tideway results for later use by PhpPerfTools/Gui.

21PHP

Since Jun 18Pushed 5y ago1 watchersCompare

[ Source](https://github.com/phpperftools/collector)[ Packagist](https://packagist.org/packages/phpperftools/collector)[ RSS](/packages/phpperftools-collector/feed)WikiDiscussions master Synced 1w ago

READMEChangelogDependenciesVersions (1)Used By (0)

PhpPerfTools Collector
======================

[](#phpperftools-collector)

This is a small standalone module which you can use to collect and store [XHProf](https://pecl.php.net/package/xhprof) or [Uprofiler](https://github.com/FriendsOfPHP/uprofiler) or [Tideways](https://github.com/tideways/php-xhprof-extension) performance data for later usage in [GUI](https://github.com/phpperftools/gui).

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

Usage
-----

[](#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:

```
