- How do I install and configure Laravel Query Watcher?
- Install it with Composer using composer require yorcreative/laravel-query-watcher, then publish and review the package configuration if the package provides a publish step. Set your slow-query threshold and choose whether matches should be logged, notified, or both. For the v1.4 broadcasting feature, also confirm your Pusher or Pusher-compatible broadcasting configuration and any route or config stub before enabling it. The repository README and composer.json remain the source of truth for exact commands and supported versions.
- Which Laravel and PHP versions does laravel-query-watcher support?
- Check the package composer.json and README for the exact Laravel, PHP, and pusher/pusher-php-server constraints rather than assuming broad support. v1.4.1 adds a broadcasting authorization endpoint, so your Laravel major version and existing broadcasting.php Pusher configuration must align with the package's tested constraints. Verify the endpoint expects the standard socket_id and channel_name query parameters that Laravel Echo sends. If those constraints are unclear, test in staging before upgrading production.
- How does Laravel Query Watcher detect and flag slow queries?
- Laravel Query Watcher captures the application's database queries and compares their execution time or characteristics against configurable thresholds. When a query is slow or otherwise flagged as problematic, the package can emit a warning log entry or trigger a configured notification. Because thresholds are configurable, you can tune sensitivity per environment instead of using one global cutoff. Review the package config to confirm exactly which query attributes and thresholds are evaluated.
- Can Laravel Query Watcher send notifications for slow queries?
- Yes, the package is designed to log warnings and/or trigger notifications when configured thresholds are exceeded. The exact notification channels depend on the package configuration and your application notification setup, so confirm the supported drivers and credentials before relying on alerts. In production, route alerts to a monitored channel and test delivery, because a silently failing notification defeats the purpose of query monitoring. Keep thresholds realistic to avoid alert fatigue.
- Is the Pusher private channel authorization endpoint in v1.4.1 secure?
- The endpoint is a data-access boundary: security depends on the authorization predicate scoping each query event to the authenticated user, and ideally their tenant or team, not just checking that a user is logged in. Confirm the channel name format and verify that a user who guesses another user's channel cannot subscribe and receive payloads. Test negative cases explicitly, including 403 versus 404 behavior that could leak whether a query ID exists. Also check whether the route is rate-limited and whether it is auto-registered or opt-in, because auto-registration widens exposure on upgrade.
- Does Laravel Query Watcher auto-register its broadcasting auth route?
- The TPM assessment flags this as a key question, so do not assume either behavior without inspecting the package service provider and routes. If the route is auto-registered on package discovery, it becomes live for every consumer after the dependency bump; if it is published or config-gated, enabling it is a deliberate opt-in step. Confirm the middleware group, auth guard, and CSRF handling match your client, especially for cross-origin SPAs using Laravel Echo.
- How do I test that user B cannot subscribe to user A's query event channel?
- Use a staging environment with a non-production Pusher app and two distinct authenticated users. Have user A trigger a query event on their private channel, then attempt to subscribe as user B to the same channel name using Laravel Echo private- prefix behavior. Assert that the authorization endpoint rejects user B and that no event payload is delivered; also inspect the response status to ensure it does not leak query existence. This negative test should be part of your upgrade checklist for v1.4.1.
- Does Laravel Query Watcher work in production, and what is the performance overhead?
- It is intended for both development and production monitoring, but overhead depends on how queries are captured and how much logging or notification work is enabled. Use sensible thresholds, avoid alert storms, and confirm that any broadcasting path only runs when your application actually uses the Pusher driver; applications on log or null broadcast drivers are unaffected by the new endpoint. Review the package capture configuration and test under production-like load before enabling broad monitoring.
- What are alternatives to Laravel Query Watcher for query monitoring?
- Common alternatives include Laravel Telescope and Debugbar for development inspection, Laravel Pulse for application performance metrics, and APM or error-tracking services such as Sentry, New Relic, or Scout APM for production tracing. Laravel Query Watcher is narrower: it captures queries and applies configurable slow or problematic query thresholds with logging or notifications. Choose it when you want lightweight, package-level query alerting rather than a full observability platform.
- How is laravel-query-watcher maintained, and should I pin the version?
- v1.4.1 is a patch release that adds a Pusher private-channel authorization endpoint, which is security-sensitive enough to justify pinning to ~1.4.1 rather than floating. Review the changelog and release notes, confirm test coverage including unauthorized subscription rejection, and check the maintainer release cadence before depending on it long term. If you need guaranteed support timelines, treat that as a procurement question rather than assuming patch versions imply full backward compatibility.