yj-php-utils/class-finder
Composer 安装命令:
composer require yj-php-utils/class-finder
包简介
Class finder utility
README 文档
README
For what?
Do you need get classes from specific namespace in a easy way? 🚀
Check this package.
Requirements
- Using composer (Needed for search in autoload composer.json)
- PSR-4 implementations
- PHP 7.3 >=
Instalation
composer require yj-php-utils/class-finder
Usage
// Your basePath project. $basePath = defined('BASE_PATH') ? BASEPATH : '/var/www/html/your_project_base_path'; // List all classes in App\Http\Controllers namespace $classes = \ClassFinder\Finder::findClassesInNamespace($basePath, 'App\Http\Controllers')->get(); // List all classes in '.' directory $classes = \ClassFinder\Finder::findClassesInPath($basePath, __DIR__)->get(); // With filters $classes = \ClassFinder\Finder::findClassesInNamespace($basePath, 'App\Http\Controllers') ->extends('\App\Http\Controllers\Controller') ->implements('\App\Http\Controllers\ApiInterface') ->where(function(string $namespace){ // get all classes that has index() method return method_exists($namespace, 'index'); }) ->get();
统计信息
- 总下载量: 10
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2021-02-10