gears/class-finder
最新稳定版本:v1.0.2
Composer 安装命令:
composer require gears/class-finder
包简介
Utility class to help you discover other classes / namespaces based on the composer auto loader.
README 文档
README
Looking for maintainers, I no longer do much if any PHP dev, I have moved on, mostly work in dotnet core, node.js & golang these days. If anyone is keen to take over these projects, get in touch - brad@bjc.id.au
Class Finder, like Symfony\Finder but for classes.
Utility class to help you discover other classes / namespaces based on the composer auto loader.
How to Install
Installation via composer is easy:
composer require gears/class-finder
Examples
// Make sure you grab the composer ClassLoader instance, the class finder needs it. $composer = require('vendor/autoload.php'); // Create a new finder. You may reuse this as much as you like. // Right now caching is not performed but could be in the future. $finder = new Gears\ClassFinder($composer); // Find all classes inside a namespace $classes = $finder->namespace('Foo\\Bar')->search(); // Returns an array like: $classes = [ '/home/user/project/vendor/foo/src/Bar/Baz.php' => 'Foo\\Bar\\Baz', '/home/user/project/vendor/foo/src/Bar/Qux.php' => 'Foo\\Bar\\Qux', 'etc...' ]; // Find all classes inside a namespace that implement an interface. $classes = $finder->namespace('Foo\\Bar')->implements('SomeInterface')->search(); // OR you can use the PHP 5.5 ::class operator $classes = $finder->namespace('Foo\\Bar')->implements(SomeInterface::class)->search(); // Or filter by parent classes $classes = $finder->namespace('Foo\\Bar')->extends(SomeParent::class)->search(); // NOTE: You can't do both out of the box. $classes = $finder->namespace('Foo\\Bar') // This is now allowed! ->implements(SomeInterface::class) ->extends(SomeParent::class) ->search(); // Although you could supply your own custom filter that implemented whatever filtering you like. $classes = $finder->namespace('Foo\\Bar')->filterBy(function($rClass ReflectionClass) { /* custom logic goes here, must return true or false */ })->search(); // ClassFinder also implements the IteratorAggregate & Countable interfaces. $number = $finder->namespace('Foo\\Bar')->count(); foreach ($finder->namespace('Foo\\Bar') as $filepath => $fqcn) { }
Developed by Brad Jones - brad@bjc.id.au
gears/class-finder 适用场景与选型建议
gears/class-finder 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 94.88k 次下载、GitHub Stars 达 4, 最近一次更新时间为 2017 年 02 月 27 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「reflection」 「class」 「finder」 「discover」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 gears/class-finder 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 gears/class-finder 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 gears/class-finder 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Library emulating the PHP internal reflection using just the tokenized source code.
PHP Library to get the apple-touch-icons and favicon from a website.
Collection of methods that I or you usually use.
A very simple yet useful helper class to handle PHP file uploads.
Parse use statements for a reflection object
Generate UML class diagrams by reflection for your PHP projects
统计信息
- 总下载量: 94.88k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 4
- 点击次数: 21
- 依赖项目数: 5
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2017-02-27