sebastian/object-reflector
sebastian/object-reflector lets you reflect an object's properties, including inherited, private, and protected ones. Install it via Composer to inspect and access object state that PHP's default reflection utilities don't easily expose.
ReflectionClass/ReflectionProperty helpers across the test suite. With ~6.3k stars and adoption inside PHPUnit itself, it is the conservative choice over bespoke code.dump()/dd() cannot reach private and inherited properties. This reduces time-to-diagnosis, which is a support-cost lever rather than a roadmap item.Consider adoption when:
require-dev and never runs in production request paths.ReflectionClass is insufficient or where existing manual reflection code is duplicated across the suite (inherited, private, protected, trait-declared properties).App\Support\PropertyInspector or a test trait) and add a static-analysis rule to block usage outside tests.Look elsewhere / decline when:
ReflectionProperty::setValue() directly.For executives (one paragraph): We're proposing a small, free, permissively licensed developer tool that helps our engineers test and debug complex code faster. It's used inside PHPUnit — the framework our test suite already depends on — so it's about as validated as a utility library gets. It ships only in development and testing environments: it has no production footprint, no performance impact on customers, no new security surface, and no external dependencies to monitor. The cost is effectively zero; the benefit is less custom test plumbing to maintain and faster diagnosis of tricky defects. The one thing we must budget for is a small version-pin check each time we upgrade PHP.
For engineering: Add as require-dev, pin the major version to our PHP runtime, and immediately wrap it in a single internal helper so no application code imports it directly. Replace ad-hoc ReflectionClass boilerplate in tests incrementally, starting with the messiest legacy suites. Add a PHPStan/CI rule that fails if the namespace appears outside tests/. Policy: assert behavior first; reflect only when behavior isn't observable — and treat every new use as a signal to ask whether the object's public seam should change instead. Track it as a migration aid with an owner, not as a permanent architectural fixture.
How can I help you explore Laravel packages today?