Download the PHP package zeeshantariq/laravel-api-profiler without Composer
On this page you can find all versions of the php package zeeshantariq/laravel-api-profiler. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download zeeshantariq/laravel-api-profiler
More information about zeeshantariq/laravel-api-profiler
Files in zeeshantariq/laravel-api-profiler
Package laravel-api-profiler
Short Description Production-grade performance observability for Laravel APIs - track database queries, external API calls, memory usage, and execution time with interactive dashboard
License MIT
Informations about the package laravel-api-profiler
π Laravel API Profiler
Productionβgrade performance observability for Laravel APIs
Laravel API Profiler helps you understand why your APIs are slow by tracking database queries, external API calls, memory usage, and execution time β all in one powerful dashboard.
β¨ Features
- β±οΈ Request & route performance
- ποΈ SQL query timing + N+1 detection
- π External HTTP call tracking
- π§ Bottleneck detection (DB, HTTP, Memory, App)
- π Interactive dashboard with charts
- π¨ Slow request & anomaly alerts
- π§ Route based analytics
π§ Why not Telescope?
| Feature | Telescope | Laravel API Profiler |
|---|---|---|
| Production safe | β | β |
| N+1 detection | β | β |
| Bottleneck detection | β | β |
| API focused | β | β |
| Performance charts | β | β |
π Installation
π§ Usage
Basic Setup
Add the middleware to your API routes:
Or use the middleware alias:
Access the Dashboard
Visit the dashboard at:
Configuration
Publish the config file:
Available configuration options in config/api-profiler.php:
Environment Variables
Add to your .env file:
π Dashboard Features
Main Dashboard (/api-profiler/dashboard)
- Overview Stats: Total requests, slow requests, active alerts
- Request Breakdown Chart: Visual timeline showing DB, HTTP, Middleware, and Controller time
- Route Performance Chart: Average duration per route over time
Requests Page (/api-profiler/requests)
- List of all profiled requests
- Search and filter functionality
- Click any request to see detailed analysis
Request Detail Page
For each request, you can see:
- Performance Metrics: Duration, memory usage, query count, HTTP calls
- Bottleneck Detection: Identifies if the issue is Database, HTTP, Memory, or Application
- N+1 Detection: Highlights repeated queries with suggestions
- Timeline Tab: Visual breakdown of request execution
- Queries Tab: All SQL queries with execution times
- HTTP Calls Tab: External API calls with durations
Routes Page (/api-profiler/routes)
- Performance metrics grouped by route
- Average duration, slow request count, error count
- Health status indicators
Alerts Page (/api-profiler/alerts)
- Slow requests (>500ms by default)
- High memory usage alerts
- N+1 query detection alerts
- Click to view detailed request analysis
π§ͺ Example
Calling:
The profiler will show:
- Total Duration: 980ms
- Database Time: 760ms (77% of total)
- SQL Queries: 32 queries executed
- N+1 Detected: Query executed 15+ times
- Bottleneck: Database
- Alert: Slow Request (>500ms)
This helps you identify that the issue is database-related and likely due to N+1 queries.
π How It Works
Automatic Tracking
The profiler automatically tracks:
- Database Queries: Every SQL query with execution time
- HTTP Calls: External API requests via Laravel's HTTP client
- Memory Usage: Peak memory consumption per request
- Execution Time: Total request duration broken down by component
Bottleneck Detection
The profiler identifies the main performance bottleneck:
- Database: If DB time > 200ms
- External API: If HTTP time > 300ms
- Memory: If memory usage > 128MB
- Application: Otherwise
N+1 Query Detection
Automatically detects when the same query is executed multiple times (threshold: 5+ times), suggesting potential N+1 problems that can be solved with eager loading.
Performance impact
The profiler is designed to be lightweight:
- Data is stored asynchronously
- Minimal overhead on requests
- Can be disabled in production if needed via config
πΈ Screenshots
(Add screenshots of your dashboard here)
π Requirements
- PHP >= 8.2
- Laravel >= 11.0
- MySQL/PostgreSQL/SQLite
π§ Roadmap
- Realβtime WebSocket dashboard
- Slack & Email alerts
- Perβroute baselines
- Anomaly detection
- Team dashboards
- Export reports
- API endpoints for programmatic access
π€ Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
π License
This package is open-sourced software licensed under the MIT license.
π€ Author
Zeeshan Tariq
Laravel Architect & AI Engineer
π License
MIT
All versions of laravel-api-profiler with dependencies
illuminate/support Version ^11.0|^12.0
illuminate/database Version ^11.0|^12.0
illuminate/routing Version ^11.0|^12.0
illuminate/http Version ^11.0|^12.0