Download the PHP package phpner/laravel-profiler without Composer
On this page you can find all versions of the php package phpner/laravel-profiler. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download phpner/laravel-profiler
More information about phpner/laravel-profiler
Files in phpner/laravel-profiler
Package laravel-profiler
Short Description Laravel package for measuring and logging memory usage and execution time
License MIT
Informations about the package laravel-profiler
Laravel Memory Profiler
Measure peak memory and execution time in your Laravel app β for HTTP requests and Artisan commands. Ships with headers, logs, and optional Telescope integration.
Features
- π Precise metrics: duration (ms), start/end/peak memory and memory diff.
- π HTTP profiling via middleware + optional response headers:
X-Memory-Peak,X-Duration-ms. - π§° Artisan profiling via a simple trait wrapper.
- π§± Manual spans (start/stop) via the service or facade.
- πͺ΅ Pluggable outputs: app log, Laravel Telescope (or both).
- ποΈ Threshold: only log when peak memory exceeds N bytes.
Requirements
- PHP >= 8.1
- Laravel 10.x / 11.x / 12.x
Installation
This publishes config/laravel-memory-profiler.php.
Quick start
HTTP requests
Register the middleware (global or route group):
When enabled, each request will:
- write a log entry with metrics and request context;
- (optionally) add headers
X-Memory-PeakandX-Duration-msto the response.
Artisan commands
Wrap your command logic with the provided trait:
The profiler will log command name and exit code along with metrics.
Manual spans
Use the service (DI) or the facade to measure any piece of code.
Configuration
config/laravel-memory-profiler.php:
Common .env options
Output
Response headers (HTTP)
Log entry (example)
Telescope (optional)
Set MEMORY_PROFILER_DRIVER=telescope or both. Entries appear in Telescope Log section with the memory tag.
Why this package?
- Lightweight and framework-native.
- Zero vendor lockβin: works with logs you already collect; Telescope is optional.
- Transparent: you decide where to profile (global, group, specific commands, or manual spans).
Tips
- Start with
threshold=0in dev to see everything; raise it in prod to reduce noise. - Put the middleware only on routes you care about if you want a narrower focus.
- Pair with request IDs/correlation IDs in your logger to join app logs and memory profiles.
Roadmap
- Queue job middleware.
- Blade/Laravel Debugbar-like panel.
- Per-route configuration overrides.
Contributing
PRs and issues are welcome! Please include tests where it makes sense.
License
Released under the MIT License.