Better Reflection alternatives and similar libraries
Based on the "Code Analysis" category.
Alternatively, view Better Reflection alternatives based on common mentions on social networks and blogs.
-
PHPStan
PHP Static Analysis Tool - discover bugs in your code without running it! -
PHP CS Fixer
A tool to automatically fix PHP Coding Standards issues -
PHP Code Sniffer
PHP_CodeSniffer tokenizes PHP files and detects violations of a defined set of coding standards. -
phan
Phan is a static analyzer for PHP. Phan prefers to avoid false-positives and attempts to prove incorrectness rather than correctness. -
PHP Metrics
Beautiful and understandable static analysis tool for PHP -
PHP Mess Detector
PHPMD is a spin-off project of PHP Depend and aims to be a PHP equivalent of the well known Java tool PMD. PHPMD can be seen as an user friendly frontend application for the raw metrics stream measured by PHP Depend. -
PHPLOC
A tool for quickly measuring the size of a PHP project. -
PHP Refactoring Browser
A command line utility for refactoring PHP code. -
PhpDependencyAnalysis
Static code analysis to find violations in a dependency graph -
PHP Analyser
Performs advanced static analysis on PHP code -
Qafoo Quality Analyzer
Tool helping us to analyze software projects -
Mondrian
A static php code analysis tool using the Graph Theory -
PHP Semantic Versioning Checker
Compares two source sets and determines the appropriate semantic versioning to apply. -
Dissect
A set of tools for lexical and syntactical analysis written in pure PHP. -
PHPCheckstyle
PHPCheckstyle is an open-source tool that helps PHP programmers adhere to certain coding conventions. -
PHP Migration
A static analyzer for PHP version migration -
PHP Manipulator
Library for Analyzing and Modifying PHP Source Code
Static code analysis for 29 languages.
* Code Quality Rankings and insights are calculated and provided by Lumnify.
They vary from L1 to L5 with "L5" being the highest.
Do you think we are missing an alternative of Better Reflection or a related project?
README
Better Reflection
Better Reflection is a reflection API that aims to improve and provide more features than PHP's built-in reflection API.
Why is it better?
- You can reflect on classes that are not already loaded, without loading them
- Ability to reflect on classes directly from a string of PHP code
- Reflecting directly on closures
- Ability to extract AST from methods and functions
- Ability to return AST representation of a class or function
- Fetch return type declaration and parameter type declarations in PHP 7 code
- Moar stuff coming soon!
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](docs/features.md).
Installation
Require using composer:
composer require roave/better-reflection
Usage
<?php
use Roave\BetterReflection\BetterReflection;
$classInfo = (new BetterReflection())
->reflector()
->reflectClass(\Foo\Bar\MyClass::class);
Documentation
- [Compatibility with core Reflection API](docs/compatibility.md)
- [Basic usage instructions](docs/usage.md)
- [Using types](docs/types.md)
- [The features](docs/features.md)
- Test suite
Upgrading
Please refer to the [Upgrade Documentation](UPGRADE.md) documentation to see what is required to upgrade your installed
BetterReflection
version.
Limitations
- PHP cannot autoload functions, therefore we cannot statically reflect functions
License
This package is released under the [MIT license](LICENSE).
Contributing
If you wish to contribute to the project, please read the [CONTRIBUTING notes](CONTRIBUTING.md).
*Note that all licence references and agreements mentioned in the Better Reflection README section above
are relevant to that project's source code only.