定制 composer/class-map-generator 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

composer/class-map-generator

最新稳定版本:1.7.1

Composer 安装命令:

composer require composer/class-map-generator

包简介

Utilities to scan PHP code and generate class maps.

关键字:

README 文档

README

Utilities to generate class maps and scan PHP code.

Continuous Integration

Installation

Install the latest version with:

composer require composer/class-map-generator

Requirements

  • PHP 7.2 is required.

Basic usage

If all you want is to scan a directory and extract a classmap with all classes/interfaces/traits/enums mapped to their paths, you can simply use:

use Composer\ClassMapGenerator\ClassMapGenerator;

$map = ClassMapGenerator::createMap('path/to/scan');
foreach ($map as $symbol => $path) {
    // do your thing
}

For more advanced usage, you can instantiate a generator object and call scanPaths one or more time then call getClassMap to get a ClassMap object containing the resulting map + eventual warnings.

use Composer\ClassMapGenerator\ClassMapGenerator;

$generator = new ClassMapGenerator;
$generator->scanPaths('path/to/scan');
$generator->scanPaths('path/to/scan2');

$classMap = $generator->getClassMap();
$classMap->sort(); // optionally sort classes alphabetically
foreach ($classMap->getMap() as $symbol => $path) {
    // do your thing
}

foreach ($classMap->getAmbiguousClasses() as $symbol => $paths) {
    // warn user about ambiguous class resolution
}

License

composer/class-map-generator is licensed under the MIT License, see the LICENSE file for details.

统计信息

  • 总下载量: 110.43M
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 195
  • 点击次数: 1
  • 依赖项目数: 87
  • 推荐数: 2

GitHub 信息

  • Stars: 194
  • Watchers: 2
  • Forks: 18
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-01-04