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

Exporter Laravel Package

sebastian/exporter

Exports PHP variables into readable, stable string representations for debugging and test output. Handles scalars, arrays, objects, resources, binary strings, and recursive structures with reference tracking for clear visualization.

View on GitHub
Deep Wiki
Context7

Provides the functionality to export PHP variables for visualization

Frequently asked questions about Exporter
How do I use sebastian/exporter to replace Laravel’s dd() for debugging complex Eloquent models?
Install the package via Composer (`composer require sebastian/exporter`), then instantiate the `Exporter` class and call `export()` on your Eloquent model. For example, `dd((new Exporter())->export($user->with('posts')->get()))` will dump the entire model with relationships in a readable, recursive-safe format. This avoids PHP warnings for large objects or circular references that `dd()` might trigger.
Will sebastian/exporter work with Laravel’s financial data (e.g., moneyphp/money) without E_WARNING notices?
Yes, the package explicitly handles special floats like NAN, INF, and -INF, which are common in financial calculations. Unlike `var_dump()`, it won’t generate warnings for large or non-standard numeric values. Test with `moneyphp/money` objects by calling `export()` directly on the value or its underlying properties.
Can I use sebastian/exporter in production for logging API responses or database queries?
While technically possible, the package is designed for debugging and development. It’s not optimized for production performance (expect <5ms overhead for complex objects). For logging, use it in dev-only middleware or Monolog handlers, but avoid hot paths like API request processing. Consider caching exports in Tinker or CLI tools only.
How does sebastian/exporter handle circular references in Laravel collections (e.g., User->posts->comments)?
The exporter detects and represents circular references using memory addresses (e.g., `&00000000...`), preventing infinite loops. For Eloquent collections, this means nested relationships like `User->posts->comments` will display without crashing. Test with real-world Laravel models to ensure your specific data structures are handled correctly.
Is sebastian/exporter compatible with Laravel’s PHPUnit tests for cleaner failure messages?
Absolutely. The package is designed for PHPUnit compatibility, producing deterministic output for assertions like `assertEquals()`. Replace `var_dump()` in test failures with `export()` to get structured, readable dumps of objects/arrays. This reduces CI/CD noise by eliminating spurious warnings in test logs.
What Laravel versions and PHP versions does sebastian/exporter support?
The package supports PHP 8.1–8.2 (LTS) via `^7.0` and PHP 8.3+ via `^8.0`. For Laravel LTS (PHP 8.1–8.2), pin to `^7.0` to avoid conflicts. If using PHP 8.3+, use `^6.3` or later. Check your `composer.json` for other `sebastian/*` packages that might conflict with newer versions.
Can I integrate sebastian/exporter with Laravel Debugbar or custom logging middleware?
Yes, the exporter is framework-agnostic but works seamlessly with Laravel Debugbar. Add it to a custom debug helper (e.g., `app(Exporter)`) or use it directly in middleware. For logging, extend Monolog handlers to include `export()` output. Example: `Log::debug((new Exporter())->export($request->all()))` for structured debug logs.
Are there performance concerns when using sebastian/exporter in Laravel’s Tinker or Artisan commands?
Performance impact is minimal for debugging tools like Tinker. Benchmarks show <5ms for complex objects (e.g., Eloquent models with 10+ relationships). Avoid using it in hot paths, but it’s safe for interactive development. For repeated debugging, consider caching exports or restricting usage to dev-only environments.
How do I handle binary data (e.g., file uploads, PDFs) with sebastian/exporter?
The exporter supports binary strings by displaying them in hex-style format (e.g., `0x00010203`). For Laravel file uploads, use `export()` on the binary content directly. Note that resources (e.g., streams) are described but not exported—pair with `gettype()` for full details. Example: `export(file_get_contents($upload->getRealPath()))`.
What alternatives exist for debugging in Laravel, and why choose sebastian/exporter over them?
Alternatives include `var_dump()`, `print_r()`, or Laravel-specific tools like `spatie/laravel-debugbar`. However, `sebastian/exporter` is more robust: it handles recursion, special floats (NAN/INF), and binary data without warnings. Unlike `dd()`, it’s deterministic for testing. For Debugbar integration, use both—exporter for precision-critical cases and Debugbar for UI debugging.
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.
hexters/coinpayment
rjcodes/rjcms
act-training/laravel-permissions-manager
alimarchal/laravel-chart-of-accounts
babenkoivan/elastic-scout-driver
mkwebdesign/filament-watchdog-v5
renatomarinho/laravel-page-speed
zedmagdy/filament-business-hours
renatovdemoura/blade-elements-ui
devgeek/beacon-admin
benjamin-rqt/data-watcher-bundle
atriumphp/atrium
sandermuller/package-boost-laravel
sandermuller/boost-skills
redaxo/core
yusufgenc/filament-api-forge
l3aro/rating-star-for-filament
leek/filament-subtenant-scope
anil/file-picker
broqit/fields-ai