- How do I install and enable RowcastProfiler in a Laravel project using Rowcast?
- Run `composer require ascetic-soft/rowcast-profiler`, then wrap your Rowcast `Connection` with `ConnectionProfiler`. For Laravel integration, configure it via the `RowcastBundle` by binding the profiled connection in your service provider. The package requires Rowcast 1.x and Laravel’s Symfony-compatible components.
- Does this profiler work with Laravel’s built-in query builder or Eloquent?
- No, this package is **Rowcast-specific** and won’t work with Eloquent or Laravel’s Query Builder. If you’re using Eloquent, consider Laravel Debugbar or Telescope instead. This profiler is tailored for Rowcast’s lightweight ORM approach.
- What Laravel versions are supported by this package?
- The package requires **Laravel 8+** (due to Symfony 5+ compatibility) and Rowcast 1.x. Check the [GitHub repo](https://github.com/ascetic-soft/RowcastProfiler) for minor version updates, but it’s designed to align with Laravel’s long-term support (LTS) releases.
- How do I store profiled queries persistently (e.g., in a database or Redis)?
- The package provides a `QueryProfileStore` interface. Implement a custom store (e.g., `DatabaseQueryProfileStore`) to log queries to your database or Redis. The default `InMemoryQueryProfileStore` is volatile and not thread-safe for production.
- Will this profiler significantly slow down my Rowcast queries in production?
- The overhead is minimal (microsecond-level timing and parameter sanitization), but high-frequency queries (e.g., API loops) may amplify it. Test in staging with your actual query load. For critical paths, disable profiling or use a lower `slowQueryThresholdMs` to reduce logging.
- How are sensitive parameters (e.g., passwords, API keys) handled in query logs?
- The `DefaultParameterSanitizer` masks sensitive values (e.g., `password`, `api_key`) by default. Customize the sanitizer to exclude or obfuscate additional parameters. Review the sanitization rules to balance security and debuggability.
- Can I visualize profiled queries in a dashboard like Laravel Telescope?
- The package stores raw profiles in your configured `QueryProfileStore`. You’ll need to build a custom UI or integrate with tools like Datadog or Grafana. The default in-memory store won’t persist data, so a database-backed store is required for historical analysis.
- What happens if I migrate from Rowcast to Eloquent in the future?
- This profiler is **Rowcast-only** and won’t work with Eloquent. If you plan to migrate, evaluate Eloquent’s built-in query logging or third-party profilers like `barryvdh/laravel-debugbar` before adopting this package.
- How do I configure the slow query threshold (e.g., log queries slower than 100ms)?
- Pass the `slowQueryThresholdMs` parameter when creating `RowcastProfiler` (e.g., `new RowcastProfiler($store, $sanitizer, slowQueryThresholdMs: 100.0)`). Queries exceeding this threshold will be flagged in the store.
- Are there alternatives to this profiler for Rowcast users?
- For Rowcast, this is the only dedicated profiler. Alternatives include Laravel Debugbar (for general query logging) or rolling your own profiler by extending `ConnectionInterface`. If you’re open to Eloquent, its built-in query logging or `spatie/laravel-query-logger` are robust options.