- Can I use this bundle directly in Laravel, or is it only for Symfony?
- This is a Symfony bundle, but Laravel 9+ can integrate it via `symfony/flex` and `symfony/bundle`. You’ll need to manually enable it in `config/bundles.php` and bridge Symfony events to Laravel’s container if needed. Test compatibility in a sandbox first.
- What’s the minimum Laravel version required for this bundle?
- Laravel 9+ is required due to Symfony bundle compatibility. Ensure your project uses PHP 8.2+ and has `symfony/flex` and `symfony/bundle` installed. Laravel 10+ aligns perfectly with the bundle’s PHP 8.2+ requirement.
- How do I enable profiling for specific routes only, not all traffic?
- Use the `event_matcher.request.route_to_probability` config in `aea_tech_web_snapshot_profiler_newrelic.yaml`. Define routes with probabilities (e.g., 1% for `app_route_name_1`) to selectively profile without impacting all requests.
- Will this bundle work in production, or is it dev-only?
- This bundle is explicitly designed for production use. Unlike dev-only profilers, it integrates with New Relic’s snapshot feature to capture targeted traces in live environments while minimizing overhead.
- Do I need to install the New Relic PHP agent separately?
- Yes, this bundle requires `ext-newrelic` (version 12.1+) installed via PECL. Run `pecl install newrelic` and ensure your Laravel app already has New Relic configured before integrating this bundle.
- How do I configure the New Relic app name and license?
- Set environment variables in your `.env` file: `AEA_TECH_WEB_SNAPSHOT_PROFILER_NEWRELIC_APP_NAME=your_app` and `AEA_TECH_WEB_SNAPSHOT_PROFILER_NEWRELIC_LICENSE=your_license_key`. The bundle reads these in its YAML config.
- Can I trigger profiling via HTTP headers or query params?
- Yes, enable `header` or `request` matching in the `event_matcher` config. For example, set `header.is_enabled: true` and `name: 'x-profiling-header'` to profile requests with that header, or use `route_to_probability` for param-based triggers.
- What’s the performance impact of enabling profiling in production?
- The bundle minimizes overhead by using New Relic’s snapshot feature and selective profiling. Test in staging first, as snapshot collection adds latency. Disable globally with `is_profiling_enabled: false` when not needed.
- Are there alternatives for Laravel-specific profiling?
- Yes, consider `tideways/xhprof` for PHP profiling or `spatie/laravel-profiler` for Laravel-native tools. However, this bundle uniquely combines New Relic’s production-grade snapshots with Symfony’s event-driven flexibility.
- How do I handle Symfony bundle updates in a Laravel project?
- Monitor the bundle’s GitHub for updates and test changes in a sandbox. Use `composer update aeatech/web-snapshot-profiler-newrelic-bundle` cautiously, as Symfony bundle updates may require adjustments to Laravel’s service container or event listeners.