piotrpress / composer-classmapper
This Composer command generates a classmap.php file based on project files.
Installs: 16
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Type:composer-plugin
Requires
- php: >=7.4
- composer-plugin-api: ^2.0
README
This Composer command generates a classmap.php
file based on project files.
NOTE: The command can be executed in projects without composer.json
file too.
Installation
- Add the command as a global composer plugin:
$ composer global require piotrpress/composer-classmapper
- Allow plugin execution:
$ composer config -g allow-plugins.piotrpress/composer-classmapper true
Usage
- Execute the command in project's directory:
$ composer map [-e|--exclude [REGEX]]
NOTE: The option exclude
is regex that matches file paths to be excluded from the classmap.
- After the command execution, simply include autoload file in the project:
require __DIR__ . '/autoload.php';
Example
$ composer map -e"#/vendor/composer/(.*)#"