thecodingmachine/class-explorer
Composer 安装命令:
composer require thecodingmachine/class-explorer
包简介
Find the list of all your classes and more.
关键字:
README 文档
README
Discover PHP classes in your project.
This project aim is to offer a set of classes enabling classes/interface/trait discovery in your own project.
Currently, the project contains only one implementation based on scanning files.
GlobClassExplorer
The GlobClassExplorer will look for all classes in a given namespace.
Usage
$explorer = new GlobClassExplorer('\\Some\\Namespace\\', $psr16Cache, $cacheTtl); $classes = $explorer->getClasses(); // Will return: ['Some\Namespace\Foo', 'Some\Namespace\Bar', ...]
This explorer:
- looks only for classes in YOUR project (not in the vendor directory)
- assumes that if a file exists in a PSR-0 or PSR-4 directory, the class is available (assumes the file respects PSR-1)
- makes no attempt at autoloading the class
- is pretty fast, even when no cache is involved
By default, GlobClassExplorer will load classes recursively in sub-namespaces. You can prevent it to load classes
recursively by passing false to the 5th parameter:
$explorer = new GlobClassExplorer('\\This\\Namespace\\Only\\', $psr16Cache, $cacheTtl, null, false);
You can also get a class map using the getClassMap method.
A class map is an array associating the name of the classes found (in key), to the file they are
linked to (the real path of the file).
$classMap = $explorer->getClassMap(); foreach ($classMap as $class => $file) { echo 'Class '.$class.' found in file '.$file; }
thecodingmachine/class-explorer 适用场景与选型建议
thecodingmachine/class-explorer 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 2.08M 次下载、GitHub Stars 达 12, 最近一次更新时间为 2018 年 08 月 29 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「reflection」 「classes」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 thecodingmachine/class-explorer 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 thecodingmachine/class-explorer 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 thecodingmachine/class-explorer 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Library emulating the PHP internal reflection using just the tokenized source code.
Contao 4 Css Style Selector bundle
Parse use statements for a reflection object
Generate UML class diagrams by reflection for your PHP projects
Powerful class discovery system for Laravel with attribute-based scanning, directory traversal, and monorepo support
Debug2 is a function developed to debug PHP code of form easy, simple, pretty print, fast and safe.
统计信息
- 总下载量: 2.08M
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 12
- 点击次数: 17
- 依赖项目数: 5
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2018-08-29