adachsoft/static-class-finder
Composer 安装命令:
composer require adachsoft/static-class-finder
包简介
A robust, standalone PHP library that resolves the file path of a class based on its Fully Qualified Class Name (FQCN) using only static Composer maps.
README 文档
README
A robust, zero-dependency PHP library that resolves the file path of a class based on its Fully Qualified Class Name (FQCN) using only static Composer maps.
Features
- No Reflection: Does not load or execute the target class. Safe for files with syntax errors.
- Zero Dependencies: Requires only PHP 8.1+.
- Composer Compatible: Supports
classmap,psr-4, andpsr-0(legacy). - Lazy Loading: Loads Composer maps only when necessary.
Installation
composer require adachsoft/static-class-finder
Usage
use AdachSoft\StaticClassFinder\Locator;
// Initialize with the root path of the target project (where composer.json lives)
$projectRoot = '/var/www/target-project';
$locator = new Locator($projectRoot);
// Locate a class file
$filePath = $locator->locate('Monolog\Logger');
if ($filePath) {
echo "File found: " . $filePath;
// Output: vendor/monolog/monolog/src/Monolog/Logger.php (relative to project root)
} else {
echo "Class not found.";
}
统计信息
- 总下载量: 0
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-12-23