PHPackages                             7csn/reflection-collector - 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. 7csn/reflection-collector

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

7csn/reflection-collector
=========================

反射收集器

v1.0.0(5y ago)01131MITPHPPHP ^8.0

Since May 8Pushed 5y ago1 watchersCompare

[ Source](https://github.com/7csn/chaser-reflection-collector)[ Packagist](https://packagist.org/packages/7csn/reflection-collector)[ RSS](/packages/7csn-reflection-collector/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (2)Used By (1)

反射收集器
-----

[](#反射收集器)

静态收集器，对外提供反射对象（无则自发创建并缓存），存储反射对象类型为：类、类方法、类属性、函数、注解。

### 运行环境

[](#运行环境)

- PHP &gt;= 8.0

### 安装

[](#安装)

```
composer require 7csn/reflection-collector

```

### 应用说明

[](#应用说明)

- 常规反射（php &lt; 8）

    ```
    use chaser\collector\RelectionCollector;
    use Closure;

    # 获取类反射
    ReflectionCollector::class(string $classname): ReflectionClass;

    # 获取类方法反射
    ReflectionCollector::method(string $classname, string $methodName): ReflectionMethod;

    # 获取类属性反射
    ReflectionCollector::property(string $classname, string $propertyName): ReflectionProperty;

    # 获取函数反射
    ReflectionCollector::function(Closure|string $functionOrName): ReflectionFunction;
    ```
- 注解反射（php &gt;= 8)

    ```
    use chaser\collector\AttributeCollector;
    use Closure;

    # 获取类指定注解反射列表
    AttributeCollector::class(string $classname, string $attributeName): ReflectionAttribute[];

    # 获取类方法指定注解反射列表
    AttributeCollector::method(string $classname, string $methodName, string $attributeName): ReflectionAttribute[];

    # 获取类属性指定注解反射列表
    AttributeCollector::property(string $classname, string $propertyName, string $attributeName): ReflectionAttribute[];

    # 获取函数指定注解反射列表
    AttributeCollector::function(Closure|string $functionOrName, string $attributeName): ReflectionAttribute[];
    ```
- 可能抛出异常 chaser\\collector\\ReflectedException，错误码：

    - ReflectedException::CLASS\_NOT\_EXIST
    - ReflectedException::METHOD\_NOT\_EXIST
    - ReflectedException::PROPERTY\_NOT\_EXIST
    - ReflectedException::FUNCTION\_NOT\_EXIST

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity57

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

1828d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/26515676?v=4)[7csn](/maintainers/7csn)[@7csn](https://github.com/7csn)

---

Top Contributors

[![7csn](https://avatars.githubusercontent.com/u/26515676?v=4)](https://github.com/7csn "7csn (7 commits)")

### Embed Badge

![Health badge](/badges/7csn-reflection-collector/health.svg)

```
[![Health](https://phpackages.com/badges/7csn-reflection-collector/health.svg)](https://phpackages.com/packages/7csn-reflection-collector)
```

###  Alternatives

[happy-types/enumerable-type

Strongly typed implementation of enumerable type in PHP which helps us to write a safer more readable code.

4742.6k](/packages/happy-types-enumerable-type)

PHPackages © 2026

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