dejwcake/advanced-logger
Advanced Logger is a Laravel/PHP package that extends the framework's logging with configurable channels, richer context, and structured output, making it easier to capture, organize, and review application events in development and production with minimal setup.
This is a request-logging package with a hashing/masking layer, so the fastest path to a first result is: install, publish config, and log one route.
composer require the package, then publish its config (php artisan vendor:publish --tag=... — check the README for the exact tag).RequestLoggerService / RequestLoggerListenerHandler pair driven by RequestLogger — depending on the version's wiring you either enable a middleware or let the listener subscribe to Laravel's request events. The README's "Docker-based dev commands" section is the quickest way to get a working environment if you want to see it run before wiring it into your app.storage/logs that the request is recorded but the sensitive field is replaced by a hash rather than logged in the clear.If you only need one thing from this package, it is HashLogCustomizer: it is the extension point for saying "these keys are sensitive, hash them" so your existing log pipeline stays compliant without you rewriting log calls.
Scope logging per environment, not per call site. Keep the request logger enabled in staging and production, disabled (or downgraded to a null/array channel) in local and test. Doing this in config avoids if (app()->environment()) noise scattered through the codebase.
Treat hashing as a policy, not a one-off. Centralize the sensitive-key list (password, token, authorization, secret, card fields) in config and reuse the same customizer across request logs, job logs, and exception context. A single source of truth is what makes the masking auditable.
Wire the listener to the framework, not to your controllers. The RequestLoggerListenerHandler exists so that logging happens on the request lifecycle rather than inside your handlers. Keep controllers free of logging calls; the value of this package is that instrumentation is orthogonal to business logic.
Compose around the final classes. As of 2.0.1, HashLogCustomizer, RequestLogger, RequestLoggerListenerHandler, and RequestLoggerService are final readonly class. The intended extension pattern is decoration: wrap the service in your own class that implements the same contract, add behaviour (sampling, redaction of extra fields, correlation IDs, tenant tags), and bind your decorator in a service provider. Do not plan on subclassing.
Add correlation early. Generate or accept a request ID in middleware and push it into the log context before the request logger runs. Retrofitting correlation after you have months of logs is painful; adding it on day one costs a middleware.
Route to a dedicated channel. Point request logs at their own channel (and often their own retention) instead of the default stack. Request logs are high-volume and have different retention/PII rules than application errors, and mixing them makes both harder to search and to purge.
Use the package as a debugging aid during rollout. Before enabling globally, log a single route in staging and diff the output against what you expect — that catches both over-logging (whole payloads) and under-hashing (a nested key the customizer missed).
final readonly. This is technically a patch release, but if you extended any of them you will now get a fatal error. readonly also means no post-construction mutation, so any code that reflected into these objects or set properties will break. Migrate to composition/decorator bindings.readonly forces constructor injection. Configuration must be resolved and passed in at construction (from config, via the container), not lazily read later. If you were relying on config changes taking effect mid-request, that assumption is gone.vendor/ will not contain the package's test suite. If you want to read the tests to understand intended behaviour, clone the repository instead of inspecting vendor/. Likewise, don't expect to run the package's own Docker-based commands from an installed copy.data.user.password) and extend the key list or the customizer accordingly.Authorization, Cookie) are covered by the hashing policy, not just the body.final readonly change — there are no migrations, config renames, or deprecations in this release. Pin to ^2.0.1 and run your test suite to surface any accidental inheritance.How can I help you explore Laravel packages today?