roave/better-reflection
Composer 安装命令:
composer require roave/better-reflection
包简介
Better Reflection - an improved code reflection API
README 文档
README
Better Reflection is a reflection API that aims to improve and provide more features than PHP's built-in reflection API.
Tip
Are you reflecting on how to improve your application? We offer consulting on this library, as well as plenty of other development work. If you need any help, feel free to get in touch.
- The Roave Team
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
- 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
- Moar stuff coming soon!
Typically you would use Better Reflection for static analysis tooling. It can serve as a baseline to access type information (e.g. doc blocks, type declarations), method/function body AST fetching etc. for static analysis.
Better Reflection is NOT suited to runtime usage, since performance is much worse than PHP built-in reflection. If you do not want to do anything that native PHP reflection can't do, then just use native PHP reflection! The "Better" in Better Reflection refers to feature, not speed!
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()) ->reflector() ->reflectClass(\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/better-reflection 适用场景与选型建议
roave/better-reflection 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 13.41M 次下载、GitHub Stars 达 1.24k, 最近一次更新时间为 2015 年 07 月 02 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 roave/better-reflection 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 roave/better-reflection 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 13.41M
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1245
- 点击次数: 15
- 依赖项目数: 141
- 推荐数: 6
其他信息
- 授权协议: MIT
- 更新时间: 2015-07-02