roave/better-reflection
Better Reflection is an enhanced PHP reflection API for static analysis. Reflect on classes without loading them, from PHP code strings, and on closures; extract method/function AST and type declarations. Feature-rich but slower than native reflection (not for runtime).
Stringable or readonly properties). Build only if you require runtime performance or custom reflection logic.Avoid if:
ReflectionClass for performance).Adopt if:
Stringable, readonly properties, enums).*"BetterReflection lets us supercharge our static analysis tools—think of it as X-ray vision for PHP code. It enables us to:
Stringable) that native reflection ignores.*"This is the Swiss Army knife for PHP reflection—it does everything native reflection can’t:
readonly, Stringable) out of the box.
Tradeoff: Slower than native reflection (but only for static analysis—never runtime). Perfect for:How can I help you explore Laravel packages today?