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(2mo ago)235321.4k↓11.7%12MITPHPPHP &gt;=7.1CI passing

Since Apr 20Pushed 2mo 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 1mo 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)[![License](https://github.com/laracraft-tech/laravel-xhprof/actions/workflows/check_imports.yml/badge.svg?branch=1.x)](https://github.com/laracraft-tech/laravel-xhprof/actions/workflows/check_imports.yml)

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

[](#introduction)

Laravel XHProf provides you with a simple setup to profile your Laravel application with the well-known XHProf PHP extension originally developed by Facebook. It also leads you through the steps to install XHProf UI, a UI to visualize, save, and analyze the results of the profiling.

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

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

[](#installation)

First, you'll need to install the PHP extension. It's highly recommended to use ondrejs ppa. It's well maintained and provides quite all PHP versions.

### Normal environment

[](#normal-environment)

If you have a normal PHP environment, just install the XHProf extension:

```
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get install php php-xhprof Graphviz
# You can now check if the extension was successfully installed
php -i | grep xhprof
# maybe restart your webserver or php-fpm...
```

Note: we need Graphviz to generate callgraphs.

### Laravel Sail environment

[](#laravel-sail-environment)

If you are using laravel sail, here's a setup for you:

```
sail up -d
sail artisan sail:publish
# in docker-compose.yml check wich php version is used under build->context (eg. ./docker/8.1)
# If you know the php-version you can type:
nano docker//Dockerfile
# find the block where all php extensions are installed and add "php-xhprof graphviz \"
# Now you need to rebuild the sail
sail down ; sail build --no-cache ; sail up -d # this may take a while...
# You can now check if the extension was successfully installed
sail php -i | grep xhprof
```

Note: The provided Laravel Sail Dockerfile already uses ondrejs 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 are using the recommended fork by php.net from "preinheimer":

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

### Database

[](#database)

Since the database table name, which the UI package is using behind to store and read data from the database, is hard coded to `details` and you already may have a table named like that, you may need to take some additional steps. If not, here at first the simple way:

#### In case you DON'T already HAVE your own `details` table in your database:

[](#in-case-you-dont-already-have-your-own-details-table-in-your-database)

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

#### In case you already HAVE an own `details` table in your database:

[](#in-case-you-already-have-an-own-details-table-in-your-database)

I recommend just using a different database.

```
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: you also need to create a user who has privileges on that new database!

### Config

[](#config)

Now let's configure some settings!

```
cp public/vendor/xhprof/xhprof_lib/config.sample.php public/vendor/xhprof/xhprof_lib/config.php
# 1. Change the DB credentials to your needs
# 2. enable dot_binary section
# 3. If you're local, set $controlIPs to false
nano public/vendor/xhprof/xhprof_lib/config.php
```

Usage
-----

[](#usage)

Just set `XHPROF_ENABLED=true` in your .env file and now every request you make to your application gets profiled.
Visit `/vendor/xhprof/xhprof_html/` to see your profiling 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

56

—

FairBetter than 98% of packages

Maintenance86

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 80.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 ~101 days

Recently: every ~221 days

Total

15

Last Release

70d 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 (29 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

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

Toolbar for Laravel Telescope based on Symfony Web Profiler

8041.6M3](/packages/fruitcake-laravel-telescope-toolbar)[recca0120/laravel-tracy

A Laravel Package to integrate Nette Tracy Debugger

388283.0k3](/packages/recca0120-laravel-tracy)[daylerees/anbu

The Anbu profiler for Laravel 4.

3054.9k](/packages/daylerees-anbu)[lsrur/inspector

Laravel Inspector, debugging and profiling tools for Web Artisans

23441.1k](/packages/lsrur-inspector)[adobrovolsky97/illuminar

Debug tool for Laravel Framework

2397.1k](/packages/adobrovolsky97-illuminar)

PHPackages © 2026

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