PHPackages                             zeeshantariq/laravel-api-profiler - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Logging &amp; Monitoring](/categories/logging)
4. /
5. zeeshantariq/laravel-api-profiler

ActiveLibrary[Logging &amp; Monitoring](/categories/logging)

zeeshantariq/laravel-api-profiler
=================================

Production-grade performance observability for Laravel APIs - track database queries, external API calls, memory usage, and execution time with interactive dashboard

1.0.0(5mo ago)5171MITBladePHP ^8.2

Since Jan 11Pushed 5mo agoCompare

[ Source](https://github.com/zeeshantariq08/laravel-api-profiler)[ Packagist](https://packagist.org/packages/zeeshantariq/laravel-api-profiler)[ RSS](/packages/zeeshantariq-laravel-api-profiler/feed)WikiDiscussions main Synced today

READMEChangelogDependencies (4)Versions (2)Used By (0)

🚀 Laravel API Profiler
======================

[](#-laravel-api-profiler)

[![Latest Version](https://camo.githubusercontent.com/e3473b96170a88438bc00a3dac65eedf257620030b95b078dce19cc9c397c9cc/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7a65657368616e74617269712f6c61726176656c2d6170692d70726f66696c65722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/zeeshantariq/laravel-api-profiler)[![Total Downloads](https://camo.githubusercontent.com/ba53ebbf9750fe58d4e736d1bc4a56f57d5f64599d9a0e8a196fff6bbf47de5b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7a65657368616e74617269712f6c61726176656c2d6170692d70726f66696c65722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/zeeshantariq/laravel-api-profiler)[![Laravel](https://camo.githubusercontent.com/8f5ad7a19b92da76aaf8120a8b678c0a834ef525361dcca3993f375eb0873800/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c61726176656c2d313125324331322d726564)](https://camo.githubusercontent.com/8f5ad7a19b92da76aaf8120a8b678c0a834ef525361dcca3993f375eb0873800/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c61726176656c2d313125324331322d726564)[![PHP](https://camo.githubusercontent.com/87a9b94eb012dd8b2e6f9b91a6ceda9768e1bb9ea33ea60f540c3490534683ad/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382e322b2d626c7565)](https://camo.githubusercontent.com/87a9b94eb012dd8b2e6f9b91a6ceda9768e1bb9ea33ea60f540c3490534683ad/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382e322b2d626c7565)[![License](https://camo.githubusercontent.com/f8df3091bbe1149f398a5369b2c39e896766f9f6efba3477c63e9b4aa940ef14/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d677265656e)](https://camo.githubusercontent.com/f8df3091bbe1149f398a5369b2c39e896766f9f6efba3477c63e9b4aa940ef14/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d677265656e)[![Status](https://camo.githubusercontent.com/93be1ccbee732d3aca2a3fb50a34fff23176b79c91fb69426afd921af9f70666/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7374617475732d70726f64756374696f6e2d2d72656164792d627269676874677265656e)](https://camo.githubusercontent.com/93be1ccbee732d3aca2a3fb50a34fff23176b79c91fb69426afd921af9f70666/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7374617475732d70726f64756374696f6e2d2d72656164792d627269676874677265656e)

**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
----------

[](#-features)

- ⏱️ Request &amp; route performance
- 🗄️ SQL query timing + N+1 detection
- 🌐 External HTTP call tracking
- 🧠 Bottleneck detection (DB, HTTP, Memory, App)
- 📊 Interactive dashboard with charts
- 🚨 Slow request &amp; anomaly alerts
- 🧭 Route based analytics

---

🧠 Why not Telescope?
--------------------

[](#-why-not-telescope)

FeatureTelescopeLaravel API ProfilerProduction safe❌✅N+1 detection❌✅Bottleneck detection❌✅API focused❌✅Performance charts❌✅---

🛠 Installation
--------------

[](#-installation)

```
composer require zeeshantariq/laravel-api-profiler
php artisan migrate
```

---

🔧 Usage
-------

[](#-usage)

### Basic Setup

[](#basic-setup)

Add the middleware to your API routes:

```
use ZeeshanTariq\LaravelApiProfiler\Middleware\ApiProfilerMiddleware;

Route::middleware(['api', ApiProfilerMiddleware::class])->group(function () {
    // Your API routes
});
```

Or use the middleware alias:

```
Route::middleware(['api', 'api-profiler'])->group(function () {
    // Your API routes
});
```

### Access the Dashboard

[](#access-the-dashboard)

Visit the dashboard at:

```
http://your-app.test/api-profiler/dashboard

```

### Configuration

[](#configuration)

Publish the config file:

```
php artisan vendor:publish --tag=config --provider="ZeeshanTariq\LaravelApiProfiler\LaravelApiProfilerServiceProvider"
```

Available configuration options in `config/api-profiler.php`:

```
return [
    // Enable/disable the profiler
    'enabled' => env('API_PROFILER_ENABLED', true),

    // Slow request threshold in milliseconds
    'slow_request_threshold_ms' => 500,

    // High memory threshold in bytes (default: 128MB)
    'high_memory_bytes' => 128 * 1024 * 1024,

    // N+1 query detection threshold
    'n_plus_one_threshold' => 5,

    // Number of samples for baseline calculation
    'baseline_sample_size' => 50,

    // Middleware for dashboard routes
    'middleware' => ['web', 'auth'],
];
```

### Environment Variables

[](#environment-variables)

Add to your `.env` file:

```
API_PROFILER_ENABLED=true
```

---

📊 Dashboard Features
--------------------

[](#-dashboard-features)

### Main Dashboard (`/api-profiler/dashboard`)

[](#main-dashboard-api-profilerdashboard)

- **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`)

[](#requests-page-api-profilerrequests)

- List of all profiled requests
- Search and filter functionality
- Click any request to see detailed analysis

### Request Detail Page

[](#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`)

[](#routes-page-api-profilerroutes)

- Performance metrics grouped by route
- Average duration, slow request count, error count
- Health status indicators

### Alerts Page (`/api-profiler/alerts`)

[](#alerts-page-api-profileralerts)

- Slow requests (&gt;500ms by default)
- High memory usage alerts
- N+1 query detection alerts
- Click to view detailed request analysis

🧪 Example
---------

[](#-example)

Calling:

```
GET /api/v1/clients/15/assets

```

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 (&gt;500ms)

This helps you identify that the issue is database-related and likely due to N+1 queries.

---

🔍 How It Works
--------------

[](#-how-it-works)

### Automatic Tracking

[](#automatic-tracking)

The profiler automatically tracks:

1. **Database Queries**: Every SQL query with execution time
2. **HTTP Calls**: External API requests via Laravel's HTTP client
3. **Memory Usage**: Peak memory consumption per request
4. **Execution Time**: Total request duration broken down by component

### Bottleneck Detection

[](#bottleneck-detection)

The profiler identifies the main performance bottleneck:

- **Database**: If DB time &gt; 200ms
- **External API**: If HTTP time &gt; 300ms
- **Memory**: If memory usage &gt; 128MB
- **Application**: Otherwise

### N+1 Query Detection

[](#n1-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

[](#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
-------------

[](#-screenshots)

*(Add screenshots of your dashboard here)*

---

📝 Requirements
--------------

[](#-requirements)

- PHP &gt;= 8.2
- Laravel &gt;= 11.0
- MySQL/PostgreSQL/SQLite

🧭 Roadmap
---------

[](#-roadmap)

- Real‑time WebSocket dashboard
- Slack &amp; Email alerts
- Per‑route baselines
- Anomaly detection
- Team dashboards
- Export reports
- API endpoints for programmatic access

🤝 Contributing
--------------

[](#-contributing)

Contributions are welcome! Please feel free to submit a Pull Request.

📄 License
---------

[](#-license)

This package is open-sourced software licensed under the [MIT license](LICENSE).

---

👤 Author
--------

[](#-author)

**Zeeshan Tariq**
Laravel Architect &amp; AI Engineer

---

📄 License
---------

[](#-license-1)

MIT

###  Health Score

36

—

LowBetter than 79% of packages

Maintenance71

Regular maintenance activity

Popularity11

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity47

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

175d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/f47cff8ce3f93868b40ac01d5b9a7f4d254434b55d6850cf064b6bbf868fdab7?d=identicon)[zeeshantariq08](/maintainers/zeeshantariq08)

---

Top Contributors

[![zeeshantariq08](https://avatars.githubusercontent.com/u/46603062?v=4)](https://github.com/zeeshantariq08 "zeeshantariq08 (3 commits)")

---

Tags

apilaravelmonitoringprofilerperformancedashboardobservabilityqueriesn-plus-onebottleneck

### Embed Badge

![Health badge](/badges/zeeshantariq-laravel-api-profiler/health.svg)

```
[![Health](https://phpackages.com/badges/zeeshantariq-laravel-api-profiler/health.svg)](https://phpackages.com/packages/zeeshantariq-laravel-api-profiler)
```

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3355.3M346](/packages/psalm-plugin-laravel)[api-platform/laravel

API Platform support for Laravel

58171.6k14](/packages/api-platform-laravel)[laravel/cashier

Laravel Cashier provides an expressive, fluent interface to Stripe's subscription billing services.

2.6k29.9M148](/packages/laravel-cashier)[laravel/pulse

Laravel Pulse is a real-time application performance monitoring tool and dashboard for your Laravel application.

1.7k15.1M132](/packages/laravel-pulse)[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

9762.4M131](/packages/roots-acorn)[fleetbase/core-api

Core Framework and Resources for Fleetbase API

1235.9k20](/packages/fleetbase-core-api)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
