perfbase / laravel
A Laravel extension for the Perfbase profiling tool.
v0.2.0
2025-04-10 22:19 UTC
Requires
- php: >=7.4 <8.5
- ext-json: *
- ext-zlib: *
- guzzlehttp/guzzle: ^7.0
- illuminate/support: ^8.0|^9.0|^10.0|^11.0|^12.0
- perfbase/php-sdk: v0.2.0
Requires (Dev)
- mockery/mockery: ^1.6
- orchestra/testbench: ^6
- phpstan/phpstan: ^2.1
- phpunit/phpunit: ^9
README
Laravel integration for Perfbase - the PHP profiling service that helps you understand and optimize your application's performance.
Installation
- Install package to your laravel Project
composer require perfbase/laravel
- Publish configuration
php artisan vendor:publish --tag="perfbase-config"
- Add basic Perfbase config to your
.env
file
PERFBASE_ENABLED=true PERFBASE_API_KEY=your_key_here PERFBASE_SAMPLE_RATE=1.0
- Add our to your middleware stack
\Perfbase\Laravel\Middleware\PerfbaseMiddleware::class
- Start profiling your application!
Sending mode - local buffering
If you'd like to buffer data before sending it to Perfbase, you can configure the PERFBASE_SENDING_MODE
option.
The available sending mode values are:
sync
: Sends data immediately without buffering.database
: Stores data in files before sending it to Perfbase.file
: Caches data in a database table before sending.
Available Commands
# Send locally buffered traces to the API, then removes your locally buffered copy. # Consider running this command in a scheduled cron job. php artisan perfbase:sync # Delete all locally buffered traces. (Useful for debugging, or destruction) php artisan perfbase:clear
Requirements
- PHP 7.4 or higher
- Laravel 8.0 or higher
- Perfbase PHP extension
Contributing
Please see CONTRIBUTING.md for details.
Security
If you discover any security related issues, please email security@perfbase.com instead of using the issue tracker.
License
The Apache License Version 2.0. Please see License File for more information.