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.
SplObjectStorage (critical for debugging iterators/collections) and improved binary string readability (e.g., API responses with base64-encoded payloads).E_WARNING suppression; new features are non-breaking and further reduce CI/CD noise.SplObjectStorage iterator position preservation avoids unintended state changes during debugging (e.g., when inspecting iterated collections like Symfony\Component\EventDispatcher\EventDispatcher).SplObjectStorage-backed listeners/observers without resetting iteration state.Symfony\Component\HttpFoundation\File\UploadedFile or Laravel\Bus\PendingDispatch (queued jobs with binary payloads).var_dump() for base64/hex-encoded data (e.g., dd($request->getContent()) now shows readable snippets).dd($eventDispatcher->getListeners()) where iterator positions were lost.| Risk Area | Mitigation Strategy |
|---|---|
SplObjectStorage Breaking Change |
None: Change is backward-compatible (preserves existing behavior while fixing a bug). |
| Binary String Output | Test with real-world binary data (e.g., PDFs, encrypted payloads) to validate readability. |
| PHP 8.3+ Compatibility | New release drops PHP 8.1 support; ensure alignment with Laravel’s PHP policy (e.g., 8.2+). |
| Performance Impact | Benchmark SplObjectStorage handling in high-iteration scenarios (e.g., event listeners). |
| Deprecation Warnings | Monitor for PHP 8.5+ changes (e.g., stricter binary string handling). |
dd() for all SplObjectStorage cases (e.g., Symfony event listeners, custom iterators), or only for specific edge cases?Exporter be the default tool for debugging $request->getContent()?EventDispatcher default to this package for listener debugging in Tinker/Debugbar?SplObjectStorage, will this reduce bugs in Laravel’s event system debugging?SplObjectStorage-backed listeners without iterator corruption.$request->getContent() or queued jobs with binary payloads.IteratorAggregate objects (e.g., Laravel\Collections\LazyCollection).SplObjectStorage fixes and binary string improvements.UploadedFile and EventDispatcher debugging.require-dev setup.dd($request->getContent()) with:
$exporter->export($request->getContent(), Exporter::TO_STRING);
dd() calls for EventDispatcher listeners:
$exporter->export($eventDispatcher->getListeners());
E_WARNING regressions in test logs.SplObjectStorage performance in high-iteration scenarios.| Component | Compatibility Notes |
|---|---|
| PHP 8.2+ | Required for SplObjectStorage fixes and binary string improvements. |
| Symfony 6.4+ | Full support for UploadedFile and EventDispatcher. |
| Laravel 10+ | No framework changes; works with existing require-dev setup. |
SplObjectStorage |
Iterator position is now preserved (fixes edge cases in event listeners). |
| Binary Strings | Readable output for base64/hex-encoded data (e.g., API payloads). |
| Custom Iterators | Safe inspection of IteratorAggregate objects without state corruption. |
SplObjectStorage fixes in Laravel/Symfony event debugging.var_dump() incrementally for iterators/collections.Exporter for unified output.SplObjectStorage in high-iteration loops (e.g., 100+ listeners).composer.json under require-dev.SplObjectStorage/binary string changes.Exporter for binary data (e.g., dd($file->getContent()) → export($file->getContent())).SplObjectStorage performance in event-heavy apps.TO_STRING flag for large payloads:
$exporter->export($binaryData, Exporter::TO_STRING, 200); // Limit to 200 chars
Exporter if default output is insufficient (rare).SplObjectStorage: Fixed iterator corruption; no performance regression.shortenedExport).| Scenario | Impact | Mitigation |
|---|---|---|
| Binary Data Exposure | Accidental logging of sensitive data. | Use shortenedExport() with char limits. |
| Iterator Corruption | Debugging fails for event listeners. | Fixed in 8.1.0; no action needed. |
| PHP 8.3+ Warnings | New binary string handling triggers warnings. | Monitor releases; suppress if needed. |
Large SplObjectStorage |
High memory in CI/CD. | Use shortenedExport() for listeners. |
// Binary Data
$exporter->export($request->get
How can I help you explore Laravel packages today?