Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Snapshot Profiler

Snapshot Profiler Laravel Package

aeatech/snapshot-profiler

Laravel/PHP snapshot profiler that captures lightweight performance snapshots of requests and code execution. Helps you track timing, memory usage, and key metrics over time for debugging and regression detection, with simple integration into existing apps.

View on GitHub
Deep Wiki
Context7

The package contains implementation of \AEATech\SnapshotProfilerContracts\ProfilerInterface to profile applications

Frequently asked questions about Snapshot Profiler
How do I integrate this profiler into an existing Laravel application?
Install via Composer (`composer require aeatech/snapshot-profiler`), then manually wire the `ProfilerInterface` into your app’s bootstrapping logic (e.g., service container or middleware). Since it lacks Laravel-specific abstractions, you’ll need to define how snapshots are triggered—commonly via HTTP middleware, CLI commands, or queue job events. Start with a non-critical endpoint to test overhead.
Does this work with Laravel’s HTTP lifecycle (middleware, routes, controllers)?
No, the package doesn’t include Laravel-specific integrations like middleware or route hooks. You’ll need to manually bind the profiler to Laravel’s container (e.g., `app()->bind()`) and wrap execution points (e.g., `app()->terminating()` for request-level profiling). For async processes like queues, use event listeners or job middleware.
What Laravel versions are supported, and is PHP 8.2 required?
The package requires **PHP 8.2+** but doesn’t explicitly list Laravel versions. Since it’s framework-agnostic, it should work with Laravel 9+ or 10+, but test thoroughly—especially for service container interactions. Check the [GitHub](https://github.com/AEATech/snapshot-profiler) for updates, though the repo lacks versioning details.
Can I profile Eloquent queries, queue jobs, or scheduled tasks?
Not natively. The profiler tracks general PHP execution (e.g., method calls, memory) but lacks Laravel-specific hooks for Eloquent, queues (Horizon), or tasks. To profile these, wrap their execution manually (e.g., `SnapshotProfiler::start()` before a query/job, `end()` afterward) or extend the `ProfilerInterface` to add Laravel context.
How are snapshots stored, and can I export them to tools like Blackfire or Datadog?
Storage isn’t documented, but the package likely saves snapshots as files, JSON, or in-memory objects. For compatibility with Blackfire/Datadog, you’d need to implement a custom exporter (e.g., convert snapshots to their API formats). Laravel’s logging or monitoring systems (e.g., Sentry) could also ingest snapshots if formatted as structured data.
What’s the performance overhead, and how can I minimize it?
Overhead depends on profiling granularity (e.g., method-level vs. request-level) and storage (disk vs. memory). Start with coarse sampling (e.g., request-level) and avoid profiling in production loops. The package’s lightweight design suggests minimal impact, but benchmark with `ab` or Laravel’s `--profile` flag. Disable during high-load periods if needed.
Is there a way to exclude vendor code or specific paths from profiling?
No built-in filtering exists, but you can extend the `ProfilerInterface` to add path/method exclusions (e.g., via a decorator pattern). Alternatively, post-process snapshots to strip unwanted data. For vendor code, consider profiling only your app’s namespace or using PHP’s `debug_backtrace()` to filter frames.
Can I use this alongside Laravel Debugbar, Blackfire, or Telescope?
Yes, but integration requires manual effort. Debugbar could display snapshot data via a custom tab, while Blackfire/Tideways might accept exported snapshots if formatted correctly. Telescope could store snapshots in the database if you implement a model/observer. Avoid conflicts by profiling distinct layers (e.g., use Debugbar for UI, this profiler for backend logic).
Are there alternatives with better Laravel support, like Spatie’s profiler?
Spatie’s Laravel Profiling offers deeper Laravel integration (e.g., middleware, queue workers) but may lack flexibility. Blackfire/Tideways are more mature but proprietary. This package’s strength is its **contract-driven, lightweight** design—ideal if you need custom profiling logic or want to avoid framework lock-in. Compare based on your need for Laravel-specific features vs. raw profiling control.
How do I test this in a CI/CD pipeline or production environment?
For CI, profile non-critical tests or use sampling to reduce overhead. In production, start with a feature flag or environment check (e.g., `app()->environment('local')`) to avoid runtime impact. Monitor storage growth (e.g., disk usage for snapshots) and set alerts. Since the package lacks Laravel-specific optimizations, test thoroughly in staging before full deployment.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
terminal42/code-quality-tools
codifyo/ts-generator-bundle
andydefer/laravel-cluster
testo/fiber
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity
christhompsontldr/laravel-inky