PHPackages                             laracraft-tech/laravel-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. laracraft-tech/laravel-xhprof

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

laracraft-tech/laravel-xhprof
=============================

Easy XHProf setup to profile your laravel application!

v1.3.0(3mo ago)235358.7k↓52.9%11MITPHPPHP &gt;=7.1CI passing

Since Apr 20Pushed 1mo ago2 watchersCompare

[ Source](https://github.com/laracraft-tech/laravel-xhprof)[ Packagist](https://packagist.org/packages/laracraft-tech/laravel-xhprof)[ Docs](https://github.com/laracraft-tech/laravel-xhprof)[ RSS](/packages/laracraft-tech-laravel-xhprof/feed)WikiDiscussions 1.x Synced 4d ago

READMEChangelog (10)Dependencies (2)Versions (17)Used By (0)

[![Logo Laravel XHProf](https://camo.githubusercontent.com/ff41808d72a3c80457bd2161a701faeb32607bc436f7bb39c2f3d18b62dde31b/68747470733a2f2f692e696d6775722e636f6d2f6e73575a6b73352e706e67)](https://camo.githubusercontent.com/ff41808d72a3c80457bd2161a701faeb32607bc436f7bb39c2f3d18b62dde31b/68747470733a2f2f692e696d6775722e636f6d2f6e73575a6b73352e706e67)

[![Total Downloads](https://camo.githubusercontent.com/dc6b188720b3a0b5b1694bcb788179e3e2aebd527398e9378047765421bdc452/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6c61726163726166742d746563682f6c61726176656c2d786870726f66)](https://packagist.org/packages/laracraft-tech/laravel-xhprof)[![Latest Stable Version](https://camo.githubusercontent.com/f26acbbb703d6c7b3ff9fa6dd291039cb64cbb68af07e8e209e2f812c527ee96/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6c61726163726166742d746563682f6c61726176656c2d786870726f66)](https://packagist.org/packages/laracraft-tech/laravel-xhprof)[![License](https://camo.githubusercontent.com/8f0364ed98b4a28577f097d90f70717daec14a35975bacde6db5d5b4b4f9b30c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6c61726163726166742d746563682f6c61726176656c2d786870726f66)](https://packagist.org/packages/laracraft-tech/laravel-xhprof)[![Laravel Compatibility](https://camo.githubusercontent.com/e7299035d945931c8634bf3121d54075aa4fc58e7c18e501080ecc1926be4145/68747470733a2f2f62616467652e6c61726176656c2e636c6f75642f62616467652f6c61726163726166742d746563682f6c61726176656c2d786870726f66)](https://packagist.org/packages/laracraft-tech/laravel-xhprof)

Introduction
------------

[](#introduction)

Laravel XHProf gives you a simple way to profile your Laravel application using the well-known XHProf PHP extension, originally developed by Facebook. It also walks you through setting up the XHProf UI, which lets you visualize, save, and analyze your profiling results.

[![](https://camo.githubusercontent.com/669b22b30504eda8a1150fb81995b6a02b8a4254b371e61956fe9bb86bd670bb/68747470733a2f2f692e696d6775722e636f6d2f744e42686950672e706e67)](https://camo.githubusercontent.com/669b22b30504eda8a1150fb81995b6a02b8a4254b371e61956fe9bb86bd670bb/68747470733a2f2f692e696d6775722e636f6d2f744e42686950672e706e67)

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

[](#installation)

First, you'll need to install the PHP extension. We highly recommend using Ondrej's PPA, since it's well maintained and covers pretty much every PHP version.

### Native PHP environment

[](#native-php-environment)

If you're running PHP natively on your system, just install the XHProf extension:

```
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get install php php-xhprof Graphviz
# Verify the extension is loaded
php -i | grep xhprof
# you might need to restart your webserver or php-fpm afterwards
```

Note: Graphviz is required to generate callgraphs.

### Laravel Sail environment

[](#laravel-sail-environment)

If you're using Laravel Sail, here's how to set things up:

```
sail up -d
sail artisan sail:publish
# Check docker-compose.yml to see which PHP version is used under build->context (e.g. ./docker/8.1)
# Then open the matching Dockerfile:
nano docker//Dockerfile
# Find the block where all PHP extensions get installed and add "php-xhprof graphviz \"
# Now rebuild Sail
sail down ; sail build --no-cache ; sail up -d # this may take a while...
# Verify the extension is loaded
sail php -i | grep xhprof
```

Note: The provided Laravel Sail Dockerfile already uses Ondrej's PPA.

### Install the Package

[](#install-the-package)

```
composer require laracraft-tech/laravel-xhprof --dev
php artisan vendor:publish --provider="LaracraftTech\LaravelXhprof\XHProfServiceProvider" --tag="config"
```

### Install the UI

[](#install-the-ui)

We use the fork by "preinheimer", which is the one recommended in the official PHP docs:

```
mkdir public/vendor ; git clone git@github.com:preinheimer/xhprof.git ./public/vendor/xhprof
# If you haven't already, we recommend adding public/vendor to your .gitignore
echo "/public/vendor" >> .gitignore
```

### Database

[](#database)

The UI package stores and reads its profiling data from a table that is hard coded to `details`. If you already have a table with that name in your database, you'll need to take a few extra steps. Otherwise, here's the straightforward path:

#### If you don't already have a `details` table in your database:

[](#if-you-dont-already-have-a-details-table-in-your-database)

```
php artisan vendor:publish --provider="LaracraftTech\LaravelXhprof\XHProfServiceProvider" --tag="migrations"
php artisan migrate
```

#### If you already have a `details` table in your database:

[](#if-you-already-have-a-details-table-in-your-database)

In this case we recommend using a separate database just for XHProf.

```
CREATE DATABASE xhprof;
USE xhprof;
CREATE TABLE IF NOT EXISTS `details` (
  `id` char(64) COLLATE utf8mb4_unicode_ci NOT NULL,
  `url` char(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `c_url` char(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `server name` char(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `perfdata` longblob,
  `type` tinyint DEFAULT NULL,
  `cookie` longblob,
  `post` longblob,
  `get` blob,
  `pmu` int DEFAULT NULL,
  `wt` int DEFAULT NULL,
  `cpu` int DEFAULT NULL,
  `server_id` char(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `aggregateCalls_include` char(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `details_url_index` (`url`),
  KEY `details_c_url_index` (`c_url`),
  KEY `details_cpu_index` (`cpu`),
  KEY `details_wt_index` (`wt`),
  KEY `details_pmu_index` (`pmu`),
  KEY `details_timestamp_index` (`timestamp`),
  KEY `details_server name_timestamp_index` (`server name`,`timestamp`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
```

Note: don't forget to create a user that has privileges on the new database!

### Config

[](#config)

Now let's configure a few settings:

```
cp public/vendor/xhprof/xhprof_lib/config.sample.php public/vendor/xhprof/xhprof_lib/config.php
# 1. Adjust the DB credentials to match your setup
# 2. Enable the dot_binary section
# 3. If you're working locally, set $controlIPs to false
nano public/vendor/xhprof/xhprof_lib/config.php
```

Usage
-----

[](#usage)

Just set `XHPROF_ENABLED=true` in your .env file, and from now on every request to your application will be profiled.
Visit `/vendor/xhprof/xhprof_html/` to view the results.

Happy analyzing!

Security
--------

[](#security)

If you discover any security-related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Zacharias Creutznacher](https://github.com/laracraft-tech)
- [All Contributors](../../contributors)

License
-------

[](#license)

MIT. Please see the [license file](license.md) for more information.

###  Health Score

55

—

FairBetter than 97% of packages

Maintenance85

Actively maintained with recent releases

Popularity53

Moderate usage in the ecosystem

Community18

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 81.6% 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 ~106 days

Recently: every ~238 days

Total

15

Last Release

48d ago

PHP version history (2 changes)v1.0.1PHP ^7.3|^8.0

v1.0.2PHP &gt;=7.1

### Community

Maintainers

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

![](https://www.gravatar.com/avatar/65c03df85c364040f9a6586a938c162ec0880a5f1f1ae9a119241abbbc189d26?d=identicon)[laracraft-tech](/maintainers/laracraft-tech)

---

Top Contributors

[![Sairahcaz](https://avatars.githubusercontent.com/u/7384870?v=4)](https://github.com/Sairahcaz "Sairahcaz (31 commits)")[![imanghafoori1](https://avatars.githubusercontent.com/u/6961695?v=4)](https://github.com/imanghafoori1 "imanghafoori1 (3 commits)")[![laravel-shift](https://avatars.githubusercontent.com/u/15991828?v=4)](https://github.com/laravel-shift "laravel-shift (2 commits)")[![a-bashtannik](https://avatars.githubusercontent.com/u/2712350?v=4)](https://github.com/a-bashtannik "a-bashtannik (1 commits)")[![ildyria](https://avatars.githubusercontent.com/u/627094?v=4)](https://github.com/ildyria "ildyria (1 commits)")

---

Tags

laravelperformancephpprofilerprofilingxhprofphplaravelprofilerprofilingprofilexhprof

### Embed Badge

![Health badge](/badges/laracraft-tech-laravel-xhprof/health.svg)

```
[![Health](https://phpackages.com/badges/laracraft-tech-laravel-xhprof/health.svg)](https://phpackages.com/packages/laracraft-tech-laravel-xhprof)
```

###  Alternatives

[bavix/laravel-xhprof

Quick profiling of your code for Laravel

22157.5k](/packages/bavix-laravel-xhprof)[fruitcake/laravel-telescope-toolbar

Toolbar for Laravel Telescope based on Symfony Web Profiler

8041.7M5](/packages/fruitcake-laravel-telescope-toolbar)[noisebynorthwest/php-spx

A simple &amp; straight-to-the-point PHP profiling extension with its built-in web UI

2.6k2.6k](/packages/noisebynorthwest-php-spx)[api-platform/laravel

API Platform support for Laravel

58171.8k14](/packages/api-platform-laravel)[daylerees/anbu

The Anbu profiler for Laravel 4.

3054.9k](/packages/daylerees-anbu)[sandstorm/plumber

Profiling Toolkit for Neos Flow and Neos

364.9k](/packages/sandstorm-plumber)

PHPackages © 2026

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