nexelity / bprof-laravel
A Laravel wrapper for the PHP bprof profiler extension
dev-main
2024-01-11 09:13 UTC
Requires
- php: ^8.0
- ext-pdo: *
- ext-zlib: *
- laravel/framework: ^10.0 || ^9.0 || >=8.40.0
Requires (Dev)
- larastan/larastan: ^1.0.4
- orchestra/testbench: ^6.41
- phpunit/phpunit: ^9.6.15
This package is auto-updated.
Last update: 2024-09-11 10:29:36 UTC
README
📚 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
- PHP
>=8.0
andext-zlib
extension enabled. - Laravel
>=8.40
- Linux or macOS (Windows is not supported)
bprof-ext
php extension installed. See here.bprof-viewer
installed and running. See here.- Eloquent compatible database (MySQL, PostgreSQL, SQLite, SQL Server)
🚀 Installation
- Install the wrapper
composer require nexelity/bprof-laravel
- Publish the config file
php artisan vendor:publish --provider="Nexelity\Bprof\BprofLaravelServiceProvider"
- 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
- Run migrations, this will create the traces table.
php artisan migrate
- Clear config cache
php artisan config:clear
- Add the middleware to your app/Http/Kernel.php
protected $middleware = [ ... \Nexelity\Bprof\Http\Middleware\BprofMiddleware::class, ];
- Start profiling!
🖥️ Artisan commands
# Truncate the traces table php artisan bprof:truncate # Trim traces older than X hours php artisan bprof:trim {ageInHours}