run_as_root / integrity-checker
Integrity checker for Composer based projects
Installs: 21 862
Dependents: 0
Suggesters: 0
Security: 0
Stars: 33
Watchers: 2
Forks: 2
Open Issues: 4
Type:project
Requires
- php: >=8.2
- ext-json: *
- ext-simplexml: *
Requires (Dev)
README
Package allows to run static analysis on Magento 2 Module Packages to provide an integrity check of package.
Supported Tools
- Composer.json package dependencies checker - check *.xml, *.js, *.php and *.phtml on a subject if other packages used inside and check if corresponding module/package is declared as required in composer.json.
- Module.xml dependencies checker - analyse if packages' etc/module.xml file contains in 'sequence' section all Magento 2 modules which classes are used in *.xml, *.js, *.php and *.phtml files of the package.
- Package structure checker - verify if all newly added Magento 2 modules has a proper structure with all required files.
Standalone Installation
- Add your access token to auth.json (see how to create access token).
composer config --global --auth gitlab-token.gitlab.com {ACCESS_TOKEN}
- Install project from gitlab repository
composer create-project run_as_root/integrity-checker --repository-url="{\"type\": \"vcs\", \"url\": \"git@gitlab.com:oleksandr.kravchuk1/integrity-checker.git\"}" -s dev integrity-checker dev-development --remove-vcs
Package Installation
- Add Gitlab repository to list of available repositories for your project composer.json
composer config repositories.integrity-checker '{"type": "vcs", "url": "git@gitlab.com:oleksandr.kravchuk1/integrity-checker.git"}'
- Add your access token to auth.json (see how to create access token).
composer config --global --auth gitlab-token.gitlab.com {ACCESS_TOKEN}
- Change packages minimum stability to
dev
(required during development only.
composer config minimum-stability dev
- Install package via composer
composer require --dev run_as_root/integrity-checker dev-development
Usage
Dependencies Checker
Basic Usage:
bin/dependencies {magento root} {folder} {folder2} {folder3}
Advanced Options:
bin/dependencies {magento root} {folder} [--ai-prompts] [--v2] [--no-legacy]
Parameters:
{magento root}
- path to Magento 2 project root directory. Tool requires composer.lock to be defined.{folder}
- expected to be relative inside the magento root folder. All packages inside folder(s) will be recognized by composer.json file.--ai-prompts
- add AI-friendly explanations after each problem for better understanding--v2
- show copy-paste ready format with full file paths (automatically enables --no-legacy)--no-legacy
- omit traditional output format (automatically enabled by --v2, or use with --ai-prompts)
Examples:
- Standard output (classic format):
bin/dependencies /path/to/magento2 src/custom-modules
Output:
Package my/custom-module has defects(s).
Missed dependencies in composer.json
- "magento/module-checkout": "*"
- "magento/module-quote": "*"
Missed dependencies in etc/module.xml
- Magento_Checkout
- Magento_Quote
- AI-friendly explanations:
bin/dependencies /path/to/magento2 src/custom-modules --ai-prompts
Output includes the standard format plus:
AI Prompt
----------
Package 'my/custom-module' at src/custom-modules/my/custom-module has 2 missing
composer dependencies: magento/module-checkout, magento/module-quote and 2
missing module.xml dependencies: Magento_Checkout, Magento_Quote. Add these to
composer.json require section and module.xml sequence section to fix loading
issues.
- Copy-paste ready format (v2 - automatically clean):
bin/dependencies /path/to/magento2 src/custom-modules --v2
Output:
------------------------------------------------------------
Missed dependencies in src/custom-modules/my/custom-module/composer.json
,
"magento/module-checkout": "*",
"magento/module-quote": "*"
------------------------------------------------------------
------------------------------------------------------------
Missed dependencies in src/custom-modules/my/custom-module/etc/module.xml
<module name="Magento_Checkout"/>
<module name="Magento_Quote"/>
------------------------------------------------------------
- Combined v2 + AI explanations (clean with AI help):
bin/dependencies /path/to/magento2 src/custom-modules --v2 --ai-prompts
Provides both the copy-paste ready format and AI explanations, with no legacy output.
- Clean AI explanations only (no legacy output) - "One Shot" Solution:
bin/dependencies /path/to/magento2 src/custom-modules --ai-prompts --no-legacy
This combination provides clean, AI-ready output perfect for:
- One-shot problem solving: Copy the AI explanation directly to ChatGPT/Claude for instant solutions
- Documentation: Clean explanations without technical noise
- Learning: Understand what needs to be fixed and why
Output:
AI Prompt
----------
Package 'my/custom-module' at src/custom-modules/my/custom-module has 2 missing
composer dependencies: magento/module-checkout, magento/module-quote and 2
missing module.xml dependencies: Magento_Checkout, Magento_Quote. Add these to
composer.json require section and module.xml sequence section to fix loading
issues.
💡 Pro Tip: Copy this output directly to any AI assistant for instant, context-aware solutions to your dependency issues!
Validation and Error Handling
The --no-legacy
flag has built-in validation to prevent confusing output:
Error case - using --no-legacy
alone:
bin/dependencies /path/to/magento2 src/custom-modules --no-legacy
Output:
Error: --no-legacy flag requires either --v2 or --ai-prompts to be specified.
Usage: bin/dependencies {magento_path} {folders} [--ai-prompts] [--v2] [--no-legacy]
...
Valid combinations:
--v2
(automatically enables --no-legacy) ✓--no-legacy --ai-prompts
✓--v2 --ai-prompts
(automatically enables --no-legacy) ✓
Notes:
- Dependencies check will be run for composer.json and etc/module.xml together.
- If no folders are specified, the tool will scan "src" and "app" by default.
- The v2 format provides exact code snippets that can be copied directly into your files.
- Leading commas in composer.json format make it easy to paste into existing require sections.
--v2
automatically enables--no-legacy
for clean, modern output.- Use
--no-legacy --ai-prompts
for the cleanest AI-ready output - perfect for "one-shot" problem solving. - The
--no-legacy
flag must be combined with--v2
or--ai-prompts
- using it alone will show an error and help. - The
--no-legacy
flag is particularly useful in CI/CD pipelines or when processing output programmatically.
Module Structure Checker
bin/structure {magento root} {folder} {folder2} {folder3}
{magento root} - path to Magento 2 project root directory. Tool collects all packages in {folder} by registration.php files. For each module it compares current structure with Standard structure and print diff, if Standard structure was not followed.
Standard package structure:
docs src etc module.xml README.md composer.json registration.php
Output Formats
The dependencies checker supports multiple output formats to suit different workflows:
Classic Format (Default)
The traditional output format showing missing dependencies in a simple list format. Compatible with all existing tooling and scripts.
AI-Friendly Format (--ai-prompts
)
Adds explanatory text after each problem, making it easier for AI assistants and developers to understand what needs to be fixed and why.
Copy-Paste Ready Format (--v2
)
Provides formatted code snippets with full file paths that can be directly copied into your project files:
- Composer dependencies with leading commas for easy pasting
- Module.xml entries in proper XML format
- Visual separators for clear section identification
- Relative file paths for easy navigation
Clean Output Mode (--no-legacy
)
Omits the traditional output format, showing only modern formats (v2 or AI explanations):
- Cleaner output for automated processing
- Ideal for CI/CD pipelines and tooling integration
- Must be combined with
--v2
or--ai-prompts
flags - Reduces noise when only specific output formats are needed
Backwards Compatibility
All existing functionality remains unchanged. The classic output format is still the default, ensuring compatibility with existing scripts, CI/CD pipelines, and tooling that depend on the original output format.