BetterReflection

:crystal_ball: Better Reflection is a reflection API that aims to improve and provide more features than PHP's built-in reflection API.

  • 所有者: Roave/BetterReflection
  • 平台:
  • 许可证: MIT License
  • 分类:
  • 主题:
  • 喜欢:
    0
      比较:

Github星跟踪图

Better Reflection

Build Status
Scrutinizer Code Quality
Code Coverage
Type Coverage
Latest Stable Version
License

Better Reflection is a reflection API that aims to improve and provide more features than PHP's built-in
reflection API.

Why is it better?

  • You can reflect on classes that are not already loaded, without loading them
  • Ability to reflect on classes directly from a string of PHP code
  • Better Reflection analyses the DocBlocks (using phpdocumentor/type-resolver)
  • Reflecting directly on closures
  • Ability to extract AST from methods and functions
  • Ability to return AST representation of a class or function
  • Fetch return type declaration and parameter type declarations in PHP 7 code
  • Change or remove PHP 7 parameter type and return type declarations from methods and functions
  • Change the body of a function or method to do something different
  • Moar stuff coming soon!

Be sure to read more in the feature documentation.

Installation

Require using composer:

$ composer require roave/better-reflection

Usage

<?php

use Roave\BetterReflection\BetterReflection;

$classInfo = (new BetterReflection())
    ->classReflector()
    ->reflect(\Foo\Bar\MyClass::class);

Documentation

Upgrading

Please refer to the Upgrade Documentation documentation to see what is required to upgrade your installed
BetterReflection version.

Limitations

  • PHP cannot autoload functions, therefore we cannot statically reflect functions

License

This package is released under the MIT license.

Contributing

If you wish to contribute to the project, please read the CONTRIBUTING notes.

主要指标

概览
名称与所有者Roave/BetterReflection
主编程语言PHP
编程语言PHP (语言数: 2)
平台
许可证MIT License
所有者活动
创建于2015-06-04 11:02:42
推送于2025-08-25 15:22:41
最后一次提交
发布数114
最新版本名称6.60.0 (发布于 2025-08-21 11:10:55)
第一版名称0.1.0 (发布于 2015-11-02 23:02:43)
用户参与
星数1.2k
关注者数27
派生数138
提交数4.3k
已启用问题?
问题数310
打开的问题数13
拉请求数1014
打开的拉请求数8
关闭的拉请求数186
项目设置
已启用Wiki?
已存档?
是复刻?
已锁定?
是镜像?
是私有?