- How do I install js/mysqlnd-analytics in a Laravel application?
- Install it with Composer using the js/mysqlnd-analytics package name, then call the library's analyser classes directly from your code. There is no service provider, facade, or config file to publish, so Laravel's package auto-discovery does nothing for you. Most teams wrap it in a small in-house adapter package and expose it through an Artisan command rather than calling it from request handlers. Confirm the artifact type against the repository first, since the js/ vendor prefix is misleading.
- Does js/mysqlnd-analytics support Laravel 11 and PHP 8.2?
- There is no evidence the codebase has been verified against PHP 8.x; it appears written for the PHP 5.x and 7.x era. Expect possible dynamic-property deprecation warnings or untyped signature issues that Laravel's error handler may surface or escalate. Run it on your exact target PHP minor in staging before adopting it. A small patch or fork is usually enough to clear the warnings, but budget for that work.
- What are MySQLnd statistics and why would I analyse them?
- MySQL Native Driver keeps internal counters for connections, queries, result-set buffering, and network protocol overhead during a PHP process's lifetime. This package normalizes those counters and applies heuristics to turn them into tuning advice. It is useful for spotting patterns like excessive connection churn or inefficient result buffering. It reports on driver behaviour, not on individual slow queries.
- Can I use js/mysqlnd-analytics as a production monitoring tool?
- It is better treated as a development and diagnostic tool rather than a production dependency. mysqlnd counters are per-process and accumulate over a worker's lifetime, and the package provides no collection, aggregation, delta, or reset mechanism. Under PHP-FPM with many short-lived workers, each sample covers a different slice of traffic, so you have to build the collection layer yourself. It suits one-off investigations on staging or during load tests far better than continuous telemetry.
- How does js/mysqlnd-analytics compare to Laravel Pulse and Telescope?
- It complements them rather than replacing them. Pulse and Telescope give you request-level telemetry and slow-query visibility, while this package produces heuristic guidance about connection usage, buffering, and protocol overhead. It will not tell you which query is slow. Use it alongside performance_schema and the slow query log when you want driver-level context.
- Why does this package need ext-mysqli instead of just pdo_mysql?
- mysqlnd statistics are read through mysqli functions such as mysqli_get_client_stats, so the mysqli extension must be present even if your application connects via PDO. Many production images install only pdo_mysql, which is a common failure point. Check with php -m in the exact image you deploy. If mysqli is missing, the library has nothing native to read.
- Does js/mysqlnd-analytics still give correct advice for MySQL 8?
- Some of the classic mysqlnd guidance relates to the MySQL query cache, which was removed in MySQL 8.0, so certain recommendations will be outdated or actively wrong on modern MySQL. On MariaDB, where the query cache still exists in some configurations, more of the advice remains relevant. Review any output against your actual MySQL or MariaDB version before acting on it.
- Can js/mysqlnd-analytics identify my slow queries?
- No. The output is heuristic advice, not measurement, so it will suggest whether connection churn, result-set buffering, or protocol overhead look inefficient. It does not attribute time to individual statements. For query-level diagnosis use the slow query log, performance_schema, or Laravel Pulse.
- Is js/mysqlnd-analytics abandoned or safe to depend on?
- It is a small, single-maintainer package with roughly 33 stars and no dependents, so do not expect active maintenance. The upside is a low supply-chain risk: it is tiny, dependency-light, and BSD-3-Clause licensed. Forking and vendoring it internally is cheap and legally clean. Pin the version and plan to own the code if you keep it.
- Is js/mysqlnd-analytics a JavaScript library because of the js/ prefix?
- The vendor prefix is misleading, but working evidence points to a standalone PHP library that consumes the mysqlnd statistics array. A JavaScript library would have nothing native to read, since mysqlnd counters are a PHP-runtime artifact. Verify against the repository before estimating any work. If a Node process really were required, it would change the integration approach entirely.