🔮 Better Reflection is a reflection API that aims to improve and provide more features than PHP's built-in reflection API.
PHP
1,249
4,627 commits
updated Oct 17, 2026
Better Reflection is a reflection API that aims to improve and provide more features than PHP's built-in reflection API.
[!TIP] Are you reflecting on how to improve your application? We offer consulting on this library, as well as plenty of other development work. If you need any help, feel free to get in touch.
- The Roave Team
Typically you would use Better Reflection for static analysis tooling. It can serve as a baseline to access type information (e.g. doc blocks, type declarations), method/function body AST fetching etc. for static analysis.
Better Reflection is NOT suited to runtime usage, since performance is much worse than PHP built-in reflection. If you do not want to do anything that native PHP reflection can't do, then just use native PHP reflection! The "Better" in Better Reflection refers to feature, not speed!
Be sure to read more in the feature documentation.
Require using composer:
composer require roave/better-reflection
<?php
use Roave\BetterReflection\BetterReflection;
$classInfo = (new BetterReflection())
->reflector()
->reflectClass(\Foo\Bar\MyClass::class);
Please refer to the Upgrade Documentation documentation to see what is required to upgrade your installed
BetterReflection version.
This package is released under the MIT license.
If you wish to contribute to the project, please read the CONTRIBUTING notes.
452 followers · starred Jul 2019
1,179 followers · starred Dec 2015
248 followers · starred Jul 2016
267 followers · starred Feb 2024
🔮 Better Reflection is a reflection API that aims to improve and provide more features than PHP's built-in reflection API.
PHP
1,249
4,627 commits
updated Oct 17, 2026
Better Reflection is a reflection API that aims to improve and provide more features than PHP's built-in reflection API.
[!TIP] Are you reflecting on how to improve your application? We offer consulting on this library, as well as plenty of other development work. If you need any help, feel free to get in touch.
- The Roave Team
Typically you would use Better Reflection for static analysis tooling. It can serve as a baseline to access type information (e.g. doc blocks, type declarations), method/function body AST fetching etc. for static analysis.
Better Reflection is NOT suited to runtime usage, since performance is much worse than PHP built-in reflection. If you do not want to do anything that native PHP reflection can't do, then just use native PHP reflection! The "Better" in Better Reflection refers to feature, not speed!
Be sure to read more in the feature documentation.
Require using composer:
composer require roave/better-reflection
<?php
use Roave\BetterReflection\BetterReflection;
$classInfo = (new BetterReflection())
->reflector()
->reflectClass(\Foo\Bar\MyClass::class);
Please refer to the Upgrade Documentation documentation to see what is required to upgrade your installed
BetterReflection version.
This package is released under the MIT license.
If you wish to contribute to the project, please read the CONTRIBUTING notes.
452 followers · starred Jul 2019
1,179 followers · starred Dec 2015
248 followers · starred Jul 2016
267 followers · starred Feb 2024