Skip to content

nexelity/bprof-laravel

Repository files navigation

BProf - Laravel

Build Status codecov

Latest Stable Version Total Downloads License

📚 Description

A Laravel wrapper package for the BProf PHP profiler.

Uncover bottlenecks, memory hogs, and performance insights in your Laravel PHP code with BProf! A heavy adaptation of the renowned XHProf library, fine-tuned for modern PHP applications.

🌟 Features

  • 🔍 Detailed function-level insights
  • 📈 Real-time application performance monitoring
  • 📊 Easy-to-visualize data
  • ⚙️ Easy integration
  • 🚀 Speed up your PHP applications!

⚙️ Pre-requisites

  1. PHP >=8.0 and ext-zlib extension enabled.
  2. Laravel >=8.40
  3. Linux or macOS (Windows is not supported)
  4. bprof-ext php extension installed. See here.
  5. bprof-viewer installed and running. See here.
  6. Eloquent compatible database (MySQL, PostgreSQL, SQLite, SQL Server)

🚀 Installation

  1. Install the wrapper
composer require nexelity/bprof-laravel
  1. Publish the config file
php artisan vendor:publish --provider="Nexelity\Bprof\BprofLaravelServiceProvider"
  1. Add the following to your .env file and modify as needed
BPROF_ENABLED=true
BPROF_VIEWER_URL=http://localhost:8080
BPROF_SERVER_NAME=My App
BPROF_DB_CONNECTION=mysql
BPROF_DB_TABLE=bprof_traces
  1. Run migrations, this will create the traces table.
php artisan migrate
  1. Clear config cache
php artisan config:clear
  1. Add the middleware to your app/Http/Kernel.php
protected $middleware = [
    ...
    \Nexelity\Bprof\Http\Middleware\BprofMiddleware::class,
];
  1. Start profiling!

🖥️ Artisan commands

# Truncate the traces table
php artisan bprof:truncate

# Trim traces older than X hours
php artisan bprof:trim {ageInHours}

About

A Laravel wrapper for the PHP bprof profiler extension

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages