loomsoftware / reflection
A ReflectionClass extension.
1.0.1
2025-07-20 20:48 UTC
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.84
- loomsoftware/badger: ^1.0
- phpstan/phpstan: ^2.1
- phpunit/phpunit: ^12.2
- symfony/var-dumper: ^7.3
README
A simple extension for the \ReflectionClass
.
Installation
composer require loomsoftware/reflection
Usage
This library provides a clean way to instantiate Reflection Classes, without having to wrap your calls inside a
try/catch
block, or worrying about exceptions.
use Loom\Reflection\Reflect;
$reflectionClass = Reflect::create($classNameThatMayOrMayNotExist);
The create static method will return either a \ReflectionClass
or null
, which you can then continue to use as you
normally would.
Methods
Get all properties with the selected Attribute. Returns: \ReflectionProperty[]
:
$reflectionClass->getAllPropertiesWithAttribute(MyCustomAttribute::class);