adachsoft/static-class-finder 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

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, and psr-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

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-12-23