PHPackages                             wangyu/reflex-core - 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. wangyu/reflex-core

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

wangyu/reflex-core
==================

原生PHP的反射注释模型,composer扩展

0.1.1(6y ago)53.0k↑177.8%23MITPHPPHP &gt;=7.1.0

Since May 3Pushed 6y agoCompare

[ Source](https://github.com/china-wangyu/php-reflex-core)[ Packagist](https://packagist.org/packages/wangyu/reflex-core)[ RSS](/packages/wangyu-reflex-core/feed)WikiDiscussions master Synced 3w ago

READMEChangelogDependenciesVersions (11)Used By (3)

php-reflex-core
===============

[](#php-reflex-core)

php 核心反射类封装

`composer` 安装
=============

[](#composer-安装)

```
composer require wangyu/reflex-core

```

使用方法
====

[](#使用方法)

首先引入命名空间`use WangYu\Reflex`
---------------------------

[](#首先引入命名空间use-wangyureflex)

```
use WangYu\Reflex;
```

获取对象反射实例
--------

[](#获取对象反射实例)

- 获取类反射实例

```
$reflex = Reflex($object);
```

- 获取类方法反射示例

```
$reflex = Reflex($object);
$actionReflex = $reflex->setMethod($action);
```

最后获取对应的方法反射文档数据
---------------

[](#最后获取对应的方法反射文档数据)

> 如果想获取下面的内容,方法的注释应当这样写

**`类注释举例：`**

```
/**
 * Class Book
 * @route('v1/book')
 * @package app\api\controller\v1
 */
class Book
{
}
```

**`获取：`**

```
$route = $reflex->get('route',['rule']);
```

**`结果：`**

```
$route = {
    ['rule' => '/v1/book/']
}
```

**`方法注释举例：`**

```
/**
 * 查询指定bid的图书
 * @route('v1/book/:bid','get')
 * @param Request $bid
 * @param('bid','bid的图书','require')
 * @return mixed
 */
public function getBook($bid)
{
    $result = BookModel::get($bid);
    return $result;
}
```

**`获取：`**

```
$route = $actionReflex->get('route',['rule','method']);
```

**`结果：`**

```
$route = {
    ['rule' => '/v1/book/','method' => 'get']
}
```

判断某个注解是否存在
----------

[](#判断某个注解是否存在)

**`方法注释举例：`**

```
/**
 * 查询指定bid的图书
 * @route('v1/book/:bid','get')
 * @param Request $bid
 * @param('bid','bid的图书','require')
 * @auth()
 * @return mixed
 */
public function getBook($bid)
{
    $result = BookModel::get($bid);
    return $result;
}
```

**`获取：`**

```
$route = $actionReflex->isExist('auth');
```

**`结果：`**

> 结果为true代表存在，为false代表不存在

```
$route = true;  # 代表存在
```

联系我们
====

[](#联系我们)

- QQ: `354007048`
- Email: `china_wangyu@aliyun.com`

###  Health Score

30

—

LowBetter than 62% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity26

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity51

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

Every ~47 days

Recently: every ~79 days

Total

9

Last Release

2229d ago

PHP version history (2 changes)0.0.1PHP &gt;=5.6.0

0.0.3PHP &gt;=7.1.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/31000104?v=4)[嗝嗝](/maintainers/china-wangyu)[@china-wangyu](https://github.com/china-wangyu)

---

Top Contributors

[![china-wangyu](https://avatars.githubusercontent.com/u/31000104?v=4)](https://github.com/china-wangyu "china-wangyu (11 commits)")

### Embed Badge

![Health badge](/badges/wangyu-reflex-core/health.svg)

```
[![Health](https://phpackages.com/badges/wangyu-reflex-core/health.svg)](https://phpackages.com/packages/wangyu-reflex-core)
```

###  Alternatives

[pguardiario/phpuri

A php library for converting relative urls to absolute.

61422.4k3](/packages/pguardiario-phpuri)

PHPackages © 2026

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