nelmio/js-logger-bundle
NelmioJsLoggerBundle integrates JavaScript error logging into Symfony applications, capturing browser-side errors and warnings and sending them to your server logs via Monolog. It helps centralize frontend issues alongside backend logs for easier debugging.
Architecture fit: Poor as a direct dependency for a Laravel application. nelmio/js-logger-bundle is a Symfony bundle, not a Laravel package. Its integration model depends on Symfony bundle auto-registration, DI extension/config tree, routing/controller conventions, and MonologBundle wiring. Laravel uses a different service container, package discovery mechanism, routing layer, and logging configuration. Composer may resolve the dependency because Laravel already uses selected Symfony components, but the bundle will not register its routes, controller, configuration, or JS asset in Laravel without a custom bridge. The architectural value is the pattern, not the package: browser-side error capture → HTTP endpoint → structured Monolog channel. That pattern maps cleanly to a small Laravel package or route/controller.
Integration feasibility: Direct adoption in a Laravel-only estate is low-feasibility and not recommended. A port/reimplementation is feasible: one route, one controller, validation/rate-limiting middleware, a dedicated Monolog channel, and a small JS listener using window.onerror and unhandledrejection. Estimated MVP effort is 1–2 backend engineer days plus frontend and security review. In a mixed Symfony/Laravel estate, the bundle can be deployed in a Symfony edge/service application and its logs forwarded to the central pipeline, but that adds a runtime hop and operational surface. If the goal is simply to capture JavaScript errors, a commercial APM/error tool may deliver more value than either path.
Technical risk: High relative to the package’s footprint. The public ingestion endpoint is the main risk: unauthenticated clients can flood logs, inject malformed content, or leak PII. Laravel middleware for rate limiting, payload limits, CORS, CSRF exclusion, and sanitization would need to be built around any port. Dependency risk is elevated by 0 dependents and 176 stars: little ecosystem validation, limited evidence of production use, and likely a small maintainer base. Symfony/Laravel component version constraints may conflict, especially around symfony/http-kernel, monolog-bundle, and Monolog major versions. The client-side snippet may not meet modern bundler, CSP, source-map, or sendBeacon expectations. The stated last release date of 2026-04-08 should be validated against the registry and changelog before relying on it.
Key questions:
connect-src and CORS posture for the ingestion endpoint?TPM recommendation: Treat this repository as a reference implementation, not a production dependency for Laravel. Build a thin internal Laravel package or use an existing error-monitoring service. Proceed only if the organization specifically wants browser errors in its existing Monolog pipeline and accepts ownership of the endpoint and client shim.
Stack fit: For a Laravel-first stack, do not add nelmio/js-logger-bundle to application composer.json. Implement an internal package, e.g. acme/laravel-js-logger, with a POST /_js-errors route, a validating controller, rate-limiting middleware, a config file, and a publishable JS asset. Write to a dedicated js_errors Monolog channel with a JSON formatter so logs can be shipped to the central platform. For a Symfony service, install the bundle there, enable it, configure the channel/level, expose the route, and forward logs centrally. Do not attempt to load the Symfony bundle inside Laravel via a custom service provider unless the team explicitly accepts a maintained bridge.
Migration path:
sendBeacon-based JS client with fetch fallback. Return 204 and never surface failures to the browser.message, stack, url, userAgent, release, and correlationId.Compatibility: Verify PHP 8.1–8.4, Laravel 10/11/12, Monolog 2/3, and Symfony component constraints with composer why-not. Check that the ingestion route is excluded from CSRF and that connect-src in CSP permits the endpoint. Confirm CORS for cross-origin frontends. Test route/config caching in Laravel. For the JS client, verify browser support, navigator.sendBeacon fallback behavior, and compatibility with the frontend build pipeline. If using the Symfony bundle, verify its supported Symfony versions and whether its controller/route assumptions match the host application.
Sequencing: Phase 0 due diligence and decision gate, 3–5 days. Phase 1 Laravel port/prototype, 1–2 weeks. Phase 2 security and privacy review, 3–5 days. Phase 3 pilot, 1–2 weeks. Phase 4 rollout and runbook, 2–4 weeks depending on app count. Keep the vendor package out of the critical path. If a Symfony deployment is chosen, sequence it after dependency audit and before central log-pipeline changes.
Maintenance: Direct Symfony-bundle use in Laravel would create an unsupported integration with high maintenance cost. A ported internal package has a small, owned surface and is preferable. Upstream activity appears modest, with 0 dependents, so do not assume timely fixes. Pin versions, document the fork/port, and assign an owner for dependency updates and security patches. Monitor the upstream repository and release notes quarterly, and validate any 2026 release artifact before upgrading.
Support: Community support is GitHub issues only; there is no commercial SLA. A TPM should secure an internal owner and runbook covering endpoint health, log volume, schema changes, and incident response. If the package is used in a Symfony service, support ownership must include that service’s deployment and log-forwarding path. If ported, the internal package becomes the support boundary.
Scaling: The endpoint is stateless and horizontally scalable, but log volume is the real constraint. Estimate events/sec as page views × errors per page × sample rate, then apply per-IP/session/app rate limits and client-side sampling. Cap payload size and batch size. Use Redis-backed rate limiting and async log shipping to avoid request-path blocking. During frontend incidents, error volume can spike by orders of magnitude; without sampling and backpressure, the endpoint can fill disks or inflate logging costs. Keep retention and indexing policies aligned with the central logging platform.
Failure modes:
Ramp-up: Budget one backend engineer for one sprint to port and harden the Laravel endpoint, half an engineer-day for the JS client, one security/privacy review, and one SRE/observability day for dashboards, alerts, and retention. Document the endpoint contract, log schema, sampling policy, and escalation path. Add alerts for ingestion error rate, log volume anomalies, and rate-limit saturation. If the decision is to use the Symfony bundle in a Symfony service, ramp-up is lower for that service but does not solve Laravel integration.
How can I help you explore Laravel packages today?