Download the PHP package perfbase/laravel without Composer
On this page you can find all versions of the php package perfbase/laravel. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download perfbase/laravel
More information about perfbase/laravel
Files in perfbase/laravel
Package laravel
Short Description A Laravel extension for the Perfbase profiling tool.
License Apache-2.0
Homepage https://github.com/perfbaseorg/laravel
Informations about the package laravel
Perfbase for Laravel
Seamless Laravel integration for Perfbase - a comprehensive Application Performance Monitoring (APM) solution that provides real-time insights into your Laravel application's performance, database queries, HTTP requests, queue jobs, and more.
Features
- 🚀 Automatic Profiling - HTTP requests, console commands, and queue jobs
- 📊 Multi-span Tracing - Track nested operations within requests
- 🔍 Database Query Monitoring - Monitor all database operations with timing
- 🌐 HTTP Request Tracking - Monitor outbound API calls and their performance
- ⚡ Queue Job Profiling - Track background job performance and failures
- 🏷️ Custom Attributes - Add contextual metadata to traces
- 🎯 Smart Sampling - Control data collection with configurable sample rates
- 💾 Flexible Data Storage - Sync immediately or buffer locally (file/database)
- 🔧 Granular Control - Include/exclude specific routes, commands, or jobs
- 🛡️ Multi-tenant Support - Organization and project-level data isolation
Requirements
- PHP: 7.4 to 8.4
- Laravel: 8.0, 9.0, 10.0, 11.0, or 12.0
- Extensions:
ext-json
(usually enabled by default)ext-zlib
(usually enabled by default)ext-perfbase
(Perfbase PHP extension)
- Dependencies: Guzzle HTTP 7.0+
Installation
1. Install the Package
2. Install the Perfbase PHP Extension
The ext-perfbase
PHP extension is required. Install it using:
Important: Restart your web server after installation.
3. Publish Configuration
This creates config/perfbase.php
with all available options.
4. Configure Environment
Add to your .env
file:
5. Add Middleware (Optional but Recommended)
For HTTP request profiling, add the middleware to your HTTP kernel:
Or apply to specific route groups:
Configuration
Basic Configuration
The package auto-registers and provides several configuration options:
Environment Variables
Variable | Default | Description |
---|---|---|
PERFBASE_ENABLED |
false |
Enable/disable profiling |
PERFBASE_API_KEY |
null |
Your Perfbase API key (required) |
PERFBASE_SAMPLE_RATE |
0.1 |
Sampling rate (0.0 to 1.0) |
PERFBASE_SENDING_MODE |
sync |
Data sending mode (sync , file , database ) |
PERFBASE_TIMEOUT |
5 |
API request timeout in seconds |
PERFBASE_PROXY |
null |
HTTP proxy URL |
PERFBASE_FLAGS |
Default flags | Profiling feature flags |
Sending Modes
Sync Mode (Default)
Data is sent immediately to Perfbase:
File Buffering
Data is stored in local files and sent later:
Database Buffering
Data is cached in your database and sent later:
Profiling Features Control
Control which profiling features are enabled:
Available flags:
UseCoarseClock
- Faster timing (reduced overhead)TrackCpuTime
- Monitor CPU time usageTrackMemoryAllocation
- Track memory allocation patternsTrackPdo
- Monitor database queriesTrackHttp
- Track outbound HTTP requestsTrackCaches
- Monitor cache operationsTrackMongodb
- Track MongoDB operationsTrackElasticsearch
- Monitor Elasticsearch queriesTrackQueues
- Track queue/background jobsTrackAwsSdk
- Monitor AWS SDK operationsTrackFileOperations
- Track file I/O operations
Include/Exclude Filters
Control which routes, commands, and jobs are profiled:
Usage
Automatic Profiling
Once configured, Perfbase automatically profiles:
- HTTP Requests (when middleware is added)
- Console Commands (all artisan commands)
- Queue Jobs (all queued jobs)
Manual Profiling
Use the facade for custom profiling:
Service Injection
Use dependency injection in your services:
User-Specific Profiling
Profile specific users by implementing the ProfiledUser
interface:
Artisan Commands
Sync Buffered Data
When using file
or database
sending modes, use this command to send buffered data:
Clear Buffered Data
Remove all locally buffered traces:
Advanced Configuration
Database Strategy Setup
When using database
sending mode, you may need to run the migration:
The package includes a migration for the perfbase_profiles
table.
Custom Cache Paths
For file-based buffering, customize the storage path:
Performance Optimization
For high-traffic applications:
Multi-Environment Setup
Facade Methods
The Perfbase facade provides access to all SDK methods:
Method | Description |
---|---|
startTraceSpan($name, $attributes = []) |
Start profiling a named span |
stopTraceSpan($name) |
Stop profiling a named span |
setAttribute($key, $value) |
Add attribute to current trace |
setFlags($flags) |
Change profiling feature flags |
submitTrace() |
Submit trace data to Perfbase |
getTraceData($spanName = '') |
Get raw trace data |
reset() |
Clear current trace session |
isExtensionAvailable() |
Check if extension is loaded |
Error Handling
The package handles errors gracefully:
Troubleshooting
Extension Not Found
Permission Issues (File Mode)
High Memory Usage
Database Issues (Database Mode)
Testing
When testing your Laravel application:
Performance Impact
- Minimal Overhead: ~1-3ms per request with default settings
- Sampling: Use sample rates to reduce impact in production
- Async Options: File/database modes reduce request impact
- Selective Profiling: Use include/exclude filters strategically
Security Considerations
- API Key Security: Store API keys in environment variables, not code
- Data Privacy: Configure include/exclude filters to avoid sensitive routes
- User Profiling: Implement
ProfiledUser
interface to control user-specific profiling - Network Security: Use HTTPS endpoints and configure proxy if needed
Examples
E-commerce Checkout
Background Job Processing
Documentation
Comprehensive documentation is available at https://docs.perfbase.com, including:
- Complete API reference
- Framework-specific guides
- Performance optimization tips
- Data privacy and security policies
- Troubleshooting guides
Contributing
We welcome contributions! Please see our contributing guidelines and feel free to submit pull requests.
Security
If you discover any security-related issues, please email [email protected] instead of using the issue tracker.
Support
- Email: [email protected]
- Documentation: https://docs.perfbase.com
- Issues: GitHub Issues
License
This project is licensed under the Apache License 2.0. Please see the License File for more information.
Made with ❤️ by the Perfbase team
All versions of laravel with dependencies
ext-json Version *
ext-zlib Version *
illuminate/support Version ^8.0|^9.0|^10.0|^11.0|^12.0
perfbase/php-sdk Version ^0.3.0
guzzlehttp/guzzle Version ^7.0