PHPackages                             bitwise-operators/utils-reflection - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. bitwise-operators/utils-reflection

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

bitwise-operators/utils-reflection
==================================

A set of utility function for use with PHP Reflection

1.0.0(5mo ago)00BSD-3-ClausePHPPHP &gt;=8.0

Since Dec 5Pushed 5mo agoCompare

[ Source](https://github.com/bitwise-operators/utils-reflection)[ Packagist](https://packagist.org/packages/bitwise-operators/utils-reflection)[ RSS](/packages/bitwise-operators-utils-reflection/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (5)Versions (2)Used By (0)

Reflection utilities
====================

[](#reflection-utilities)

A set of utility function for use with [PHP Reflection](https://www.php.net/manual/en/book.reflection.php).

Available functions
-------------------

[](#available-functions)

The following functions are supplied

All functions live in the `BitwiseOperators\Reflection` namespace.

### Checking if a class is an Attribute implementation

[](#checking-if-a-class-is-an-attribute-implementation)

#### `is_attribute_class(): bool`

[](#is_attribute_class-bool)

Arguments:

- class: `object` | `string`

### Checking if an attribute is set on a PHP entity

[](#checking-if-an-attribute-is-set-on-a-php-entity)

The following functions check if an attribute is set on the supplied class, function, method or property.

For all functions, the attribute can be supplied as a class-string or as a `ReflectionAttribute` object for the desired attribute.

Attributes are checked in instance-mode, so descendant implementations of the supplied attribute also return `true`

If no attribute class is specified, the functions return true when the subject has any attributes.

#### `class_has_attribute(): bool`

[](#class_has_attribute-bool)

Arguments:

- class: `object` | `string`,
- attribute: `null` | `string` | `ReflectionAttribute`

Checks the supplied class for attributes `$attribute`.

The class can be supplied as an `object`, a `string`, or as a `ReflectionClass` containing the subject.

#### `function_has_attribute(): bool`

[](#function_has_attribute-bool)

Arguments:

- function: `ReflectionFunctionAbstract` | `string`,
- attribute: `null` | `string` | `ReflectionAttribute`

Checks the supplied function for attributes.

The function can be supplied as a `string` or as a `ReflectionFunctionAbstract` containing the subject.

Make sure the function is fully namespaced if applicable.

#### `method_has_attribute(): bool`

[](#method_has_attribute-bool)

This function has two possible signatures:

Arguments:

- class: `object` | `string`
- method: `ReflectionMethod` | `string`
- attribute: `null` | `string` | `ReflectionAttribute`

The method can be supplied as a combination of class and method-name, where the class arguments follow the same requirements as for the `class_has_attributes` function. The method can be either a `string` or a `ReflectionMethod` containing the method.

When using a `ReflectionMethod` object, the class argument can be omitted completely:

Arguments:

- method: `ReflectionMethod`
- attribute: `null` | `string` | `ReflectionAttribute`

#### `property_has_attribute(): bool`

[](#property_has_attribute-bool)

This function has two possible signatures:

Arguments:

- class: `object` | `string`
- property: `ReflectionProperty` | `string`
- attribute: `null` | `string` | `ReflectionAttribute`

The property can be supplied as a combination of class and property-name, where the class arguments follow the same requirements as for the `class_has_attributes` function. The property can be either a `string` or a `ReflectionProperty` containing the method.

When using a `ReflectionProperty` object, the class argument can be omitted completely:

Arguments:

- property: `ReflectionProperty`
- attribute: `null` | `string` | `ReflectionAttribute`

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance71

Regular maintenance activity

Popularity0

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity40

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

164d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/002e3737db972ccd73e290b23cc5ceae1052bb535bd62b00f4443a1d7aa2cefc?d=identicon)[bitwise-operators](/maintainers/bitwise-operators)

---

Top Contributors

[![bitwise-operators](https://avatars.githubusercontent.com/u/67020940?v=4)](https://github.com/bitwise-operators "bitwise-operators (1 commits)")

---

Tags

phpreflectionattribute

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan, Rector

Code StyleECS

Type Coverage Yes

### Embed Badge

![Health badge](/badges/bitwise-operators-utils-reflection/health.svg)

```
[![Health](https://phpackages.com/badges/bitwise-operators-utils-reflection/health.svg)](https://phpackages.com/packages/bitwise-operators-utils-reflection)
```

###  Alternatives

[minime/annotations

The KISS PHP annotations library

229378.6k37](/packages/minime-annotations)[iteks/laravel-enum

A comprehensive Laravel package providing enhanced enum functionalities, including attribute handling, select array conversions, and fluent facade interactions for robust enum management in Laravel applications.

2516.7k](/packages/iteks-laravel-enum)[princejohnsantillan/reflect

Clearer API for PHP Attributes and Reflection.

1610.9k](/packages/princejohnsantillan-reflect)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
