Download the PHP package bramus/reflection without Composer
On this page you can find all versions of the php package bramus/reflection. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package reflection
bramus/reflection
bramus/reflection is a library that tries to make PHP's built-in Reflection better.
Built by Bram(us) Van Damme (https://www.bram.us) and Contributors
Prerequisites/Requirements
- PHP 7.2 or greater
Installation
Installation is possible using Composer
Usage
A note
All classes in bramus/reflection extend PHP's built-in versions. Therefore they have all of the functions like their parent class:
\Bramus\Reflection\ReflectionClassextends PHP's built-inReflectionClass.\Bramus\Reflection\ReflectionClassConstantextends PHP's built-inReflectionClassConstant.
ReflectionClass
When compared to \ReflectionClass, \Bramus\Reflection\ReflectionClass works exactly the same, but will:
- Return an associative array containing
\Bramus\Reflection\ReflectionClassConstantinstances (instead of simple values) when callinggetConstants(). - Return a
\Bramus\Reflection\ReflectionClassConstantinstance (instead of simple value) when callinggetConstant().
Here's an example comparing getConstant();
-
Using PHP's built-in
ReflectionClass: - Using
\Bramus\Reflection\ReflectionClass:
ReflectionClassConstant
When compared to \ReflectionClassConstant, \Bramus\Reflection\ReflectionClassConstant works exactly the same, but will:
- Return a
\phpDocumentor\Reflection\DocBlockinstance (instead of a string) when callinggetDocComment() - Provide you with a
getDocCommentString()method in case you want to access the contents as\ReflectionClassConstant::getDocComment()would return - Provide you with a
getSummary()shorthand, directly on the\Bramus\Reflection\ReflectionClassConstantinstance. - Provide you with a
getDescription()shorthand, directly on the\Bramus\Reflection\ReflectionClassConstantinstance.
Other Reflection Classes
Other Reflection Classes are not provided. They might be in the future.
Testing
bramus/reflection ships with unit tests using PHPUnit ~8.0.
- If PHPUnit is installed globally run
phpunitto run the tests. - If PHPUnit is not installed globally, install it locally throuh composer by running
composer install --dev. Run the tests themselves by calling./vendor/bin/phpunitor using the composer scriptcomposer test
License
bramus/reflection is released under the MIT public license. See the enclosed LICENSE for details.