sebastian/object-enumerator
Traverses arrays and object graphs to enumerate every referenced object, including nested structures and circular references. A small utility from Sebastian Bergmann's PHP testing stack, commonly pulled in by PHPUnit to walk object graphs safely.
sebastian/comparator → phpunit/phpunit), so the real product question is whether to use a capability we already pay for — not whether to procure one.Tests\Support\ObjectGraphAssertions trait or a CI-only artisan inspector — rather than product-facing features. This is a candidate for a sprint-filler ticket, not a roadmap line item.composer.json before scheduling any runtime upgrade.Adopt (or rather, formally sanction) when:
Arr:: helpers, data_get, json_encode, spl_object_id set comparison, or VarDumper genuinely can't answer the question.Look elsewhere when:
Arr / data_get) or human-readable output (dump/dd/VarDumper). This package returns a flat list of objects — it is not a debugger.Promote to an explicit require-dev only when you ship a real call site — at that point declaring it converts an implicit transitive dependency into a protected one. Wrap before first use, not after: one Support\ObjectGraph helper or test trait with intent-named methods (assertGraphHasOnly, assertNoLeakedObjects). The wrapper is the exit ramp.
For executives: "This is a zero-cost, low-risk capability from the PHPUnit ecosystem — 6,500+ stars, active maintenance, BSD-licensed, and already installed in our codebase as a transitive dependency. It improves engineering quality by letting us catch retained-reference and object-graph bugs earlier in the cycle, without funding custom traversal code or adding a production dependency. It does not touch customer-facing features and carries no framework-upgrade tax. Recommendation: sanction it as a pre-approved, dev-only capability and revisit only when a concrete use case lands. This is an engineering-efficiency decision, not a product investment."
For engineering: "sebastian/object-enumerator gives us safe recursive enumeration of referenced objects — including circular references — through non-public properties. It ships transitively with PHPUnit, so step one is an inventory (composer show), not an install. Use it for custom graph-shape assertions, memory-leak triage, clone/serialization audits, and CI-only artisan diagnostics. Three rules: it stays require-dev with zero production call sites; it goes behind a single wrapper (the class is final and exposes one method, so the wrapper is both our ergonomics and our exit ramp); and we scope-limit inputs before enumerating, because there's no depth cap and large graphs will OOM. Do not confuse it with dump() — it enumerates objects, not values, and lazy-loaded proxies will show up as objects. Verify the major version's PHP floor against our CI matrix at every upgrade; let PHPUnit drive the version and don't pin independently."
How can I help you explore Laravel packages today?