Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Laravel Log Dumper

Laravel Log Dumper Laravel Package

spatie/laravel-log-dumper

Adds an ld() helper to dump any values to your Laravel application log using Symfony VarDumper formatting. Log multiple arguments, choose or chain log levels (info/debug/error/etc.), and enable/disable logging when needed.

View on GitHub
Deep Wiki
Context7

A function to dump anything to the log

Frequently asked questions about Laravel Log Dumper
How do I install spatie/laravel-log-dumper in a Laravel project?
Run `composer require spatie/laravel-log-dumper` in your project directory. No additional configuration is needed for basic usage—just call `ld()` anywhere in your code.
Can I use `ld()` in production without risking log bloat?
Yes, but disable it explicitly via `ld()->disable()` or wrap calls in environment checks like `if (app()->environment('local'))`. Avoid dumping large objects or sensitive data in production.
What Laravel versions does this package support?
The package is officially tested on Laravel 9+. For older versions (e.g., Laravel 8), check the [GitHub releases](https://github.com/spatie/laravel-log-dumper/releases) for compatibility notes.
How does `ld()` handle complex objects like Closures or database models?
It uses Symfony VarDumper for serialization, which works well for most objects. However, Closures or resources may not serialize predictably—test with your domain-specific data. For models, use `->toArray()` first if needed.
Can I log to a specific Monolog channel (e.g., 'debug' or 'audit')?
Yes, extend the package’s `LogDumper` service provider to add channel support. Example: `ld($data, channel: 'audit')`. Review the [README](https://github.com/spatie/laravel-log-dumper) for customization details.
Is there a performance impact when using `ld()` in high-traffic APIs?
Minimal during development. For production, disable logging entirely or use async logging (e.g., Monolog’s `AsyncHandler`) to avoid I/O bottlenecks. Test with your expected request volume.
How do I chain multiple log levels (e.g., debug + error) in one call?
Use method chaining: `ld()->debug('Debug data')->error('Error data')`. Each method call logs its arguments at the specified level, maintaining execution flow.
What’s the difference between `ld()` and `Log::debug()`?
`ld()` accepts multiple arguments and formats them with VarDumper for readability, while `Log::debug()` requires a single serialized array. `ld()` is ideal for quick debugging without manual array conversion.
Can I temporarily disable `ld()` for specific code paths?
Yes, call `ld()->disable()` before the block and `ld()->enable()` afterward. Example: `ld()->disable(); $riskyOperation(); ld()->enable();`
Does this package work with Laravel’s log rotation or external tools like ELK?
Yes, it integrates with Laravel’s default Monolog setup. For ELK or structured logging, ensure your Monolog handlers (e.g., `ElasticsearchHandler`) support the output format. Pair with `ld($data, channel: 'structured')` if needed.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
christhompsontldr/phpsdk
enqueue/dsn
bunny/bunny
enqueue/test
enqueue/null
enqueue/amqp-tools
milesj/emojibase
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport