Skip to content
Proyectos

composer/class-map-generator

Ver en GitHub

Acerca de

Utilities to scan PHP code and generate class maps.

Herramientas de desarrollo

Cómo se miden estas cifras

Crecimiento de estrellas medido

in 24h
+1
in 7 days
+1
in 15 days
Recopilando historial
in 1 month
Recopilando historial

Cambios netos en períodos que se solapan, no totales diarios. Los datos no disponibles se dejan en blanco. Las estrellas indican interés, no calidad.

README.md

Original

composer/class-map-generator

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
}

foreach ($classMap->getAmbiguousFolders() as $paths) {
    // warn user that these paths only differ in casing, and therefore fold into a
    // single file/folder on case insensitive filesystems like those of Windows/macOS
}

License

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

Explorar proyectos relacionados

Cargando…