### Install Composer Class Map Generator Source: https://github.com/composer/class-map-generator/blob/main/README.md Installs the latest version of the composer/class-map-generator package using Composer. ```bash composer require composer/class-map-generator ``` -------------------------------- ### Generate Class Map - Basic Usage Source: https://github.com/composer/class-map-generator/blob/main/README.md Scans a specified directory to extract a class map, mapping symbols (classes, interfaces, traits, enums) to their file paths. This is a simple way to get all definitions from a directory. ```php use Composer\ClassMapGenerator\ClassMapGenerator; $map = ClassMapGenerator::createMap('path/to/scan'); foreach ($map as $symbol => $path) { // do your thing } ``` -------------------------------- ### Generate Class Map - Advanced Usage Source: https://github.com/composer/class-map-generator/blob/main/README.md Provides advanced control by instantiating a generator object, scanning multiple paths, and retrieving a ClassMap object. This allows for sorting the map and handling ambiguous class resolutions. ```php 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 } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.