loomsoftware/reflection

A ReflectionClass extension.

Installs: 36

Dependents: 1

Suggesters: 0

Security: 0

pkg:composer/loomsoftware/reflection

1.0.1 2025-07-20 20:48 UTC

This package is auto-updated.

Last update: 2025-09-20 21:19:37 UTC


README

Coverage 100.00% Version 1.0.0 License GPL-3.0-or-later

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);