Utilities to scan PHP code and generate class maps.

Overview

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();
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.

You might also like...
Demo of symfony/console features to build rich command line utilities

Symfony Console Demo This project is a demonstration of symfony/console features. To run the project with Docker. With bash: docker build -t myconsole

Utilities for concurrent programming of PocketMine-MP plugins.
Utilities for concurrent programming of PocketMine-MP plugins.

Utilities for concurrent programming of PocketMine-MP plugins Overview Plugin that implements the pthreads channels and in the future, promises (which

Utilities for the Contentful Rich Text

rich-text.php This library is built to help you with the parsing and rendering of the rich text field type in Contentful. It requires PHP 7.2 and up o

Testing utilities for the psr/log package that backs the PSR-3 specification.

FIG - Log Test Testing utilities for the psr/log package that backs the PSR-3 specification. Psr\Log\Test\LoggerInterfaceTest provides a base test cla

TEC UTilities (or tut) are a collection of tools for managing plugins.

TEC Utilities TEC UTilities (or tut) are a collection of tools for managing plugins. /^\ L L /

A collection of command-line utilities to aid in debugging browser engines.

Browser debug utilities This project contains several scripts that make the process of debugging browser engines much easier (some special cases excep

This Validate Class is for those who are looking for a validator that returns a code for every each error (Laravel/Api)
This Validate Class is for those who are looking for a validator that returns a code for every each error (Laravel/Api)

Validator-Class This Validate Class is for those who are looking for a validator that returns a code for every each error (Laravel/Api) Requirements A

⚗️ Adds code analysis to Laravel improving developer productivity and code quality.
⚗️ Adds code analysis to Laravel improving developer productivity and code quality.

⚗️ About Larastan Larastan was created by Can Vural and Nuno Maduro, got artwork designed by @Caneco, is maintained by Can Vural, Nuno Maduro, and Vik

The SensioLabs DeprecationDetector runs a static code analysis against your project's source code to find usages of deprecated methods, classes and interfaces

SensioLabs DeprecationDetector CAUTION: This package is abandoned and will no longer receive any updates. The SensioLabs DeprecationDetector runs a st

Releases(1.0.0)
Owner
Composer
Composer
Sitepackage for TYPO3 CMS that adheres to the recommended standards, maps all conceivable functional areas and contains examples for common use cases.

TYPO3 CMS Sitepackage This sitepackage sticks as closely as possible to the recommended standard and maps all conceivable functional areas. There are

Eric Bode 3 Dec 18, 2022
Allows generate class files parse from json and map json to php object, including multi-level and complex objects;

nixihz/php-object Allows generate class files parse from json and map json to php object, including multi-level and complex objects; Installation You

zhixin 2 Sep 9, 2022
Maps Railroad Online Savegames to a SVG map

RailroadOnlineMapper @ian76g#6577 Environments DEV - https://zwackelmann.online/ QA - https://ohnezahn.online/ PROD - https://minizwerg.online/ Gettin

Sebastian Köhler 5 Jan 3, 2023
Exploiting and fixing security vulnerabilities of an old version of E-Class. Project implemented as part of the class YS13 Cyber-Security.

Open eClass 2.3 Development of XSS, CSRF, SQLi, RFI attacks/defences of an older,vulnerable version of eclass. Project implemented as part of the clas

Aristi_Papastavrou 11 Apr 23, 2022
Magento-bulk - Bulk Import/Export helper scripts and CLI utilities for Magento Commerce

Magento Bulk Bulk operations for Magento. Configuration Copy config.php.sample to config.php and edit it. Product Attribute Management List All Attrib

Bippo Indonesia 23 Dec 20, 2022
A collection of useful codes and utilities for WordPress plugin development..

WordPress Utils A collection of useful codes and utilities for WordPress plugin development. These simplifies common tasks and promote code reusabilit

weDevs 5 Jun 9, 2023
Open-source library used in Gigadrive projects with common PHP utilities

PHP Commons This library provides PHP utilities used in Gigadrive projects, provided for the open-source community. Functions are registered globally

Gigadrive UG 3 Nov 10, 2021
This is php utilities

PHP-UTILITY This is php utilities. Requirements PHP >= 7.4 Curl extension for PHP7 must be enabled. Download Using Composer From your project director

null 2 Aug 28, 2022
This library provides a collection of native enum utilities (traits) which you almost always need in every PHP project.

This library provides a collection of native enum utilities (traits) which you almost always need in every PHP project.

DIVE 20 Nov 11, 2022
A set of utilities for working with vk api!

vk-utils Документация на русском языке Installation composer require labile/vk-utils How to use it? Simple example use Astaroth\VkUtils\Client; $api

null 1 Jan 3, 2022