vconnect / integrity-checker
Static analysis tool for Magento 2 module packages: checks composer.json/module.xml dependency integrity and generates module disassembling roadmaps.
Requires
- php: ~8.2.0|~8.3.0|~8.4.0|~8.5.0
- ext-dom: *
- ext-json: *
- ext-simplexml: *
- ext-zlib: *
- adbario/php-dot-notation: ^3.3
- composer/composer: ^2
- league/climate: ^3
- php-di/php-di: ^7.0
- webonyx/graphql-php: ^15.0
Requires (Dev)
- dealerdirect/phpcodesniffer-composer-installer: ^1.0
- laravel/pint: ^1.29
- phpcompatibility/php-compatibility: dev-develop as 9.9.9
- phpro/grumphp-shim: ^2.23
- phpstan/phpstan: ^2.2
- phpunit/phpunit: ^13.2
- rector/rector: ^2.5
- squizlabs/php_codesniffer: ^3.10|^4.0
- symfony/options-resolver: ^8.1
- symfony/var-dumper: ^6.4
- yieldstudio/grumphp-laravel-pint: ^1.0
Suggests
- vconnect/integrity-checker-composer-plugin: Enables vendor packages cache to improve analysis performaance
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 *.php, *.phtml, di.xml, system.xml, extension_attributes.xml 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 magneto 2 modules which classes are used in *.php, *.phtml, di.xml, system.xml, extension_attributes.xml files of the package.
Standalone Installation
- Install project from Vconnect satis
composer create-project vconnect/integrity-checker --repository-url="{\"type\": \"composer\", \"url\": \"https://composer.vconnect.systems\"}" integrity-checker
Package Installation
- Add Vconnect repository to list of available repositories for your project composer.json
composer config repositories.integrity-checker '{"type": "composer", "url": "https://composer.vconnect.systems"}'
- Install package via composer
composer require --dev vconnect/integrity-checker
Usage
Dependencies Checker
bin/dependencies {magento root} {folder} {folder2} {folder3}
{magento root} - path to Magento 2 project root directory. Tool require composer.lock to be defined. All packages inside {folder}'s will be recognized by composer.json file. {folder} - expected to be relative inside the magento root folder. Dependencies check will be run for composer.json and etc/module.xml together.
Disassembling Roadmap
bin/disassembling {magento root} {whitelist.txt} {explain} {no-cache}
{magento root} - path to Magento 2 project root directory. {whitelist.txt} - path to file with whitelisted modules or list of modules separated by comma. {explain} - change command strategy to provide output in the context of analysed module. Provided output either contains replace instruction or reasons why extension can not be removed. {no-cache} - flag to disable collected dependencies cache. By default, 5m cache is used.
Recommended minimum whitelist to have running Magento 2 store (with functional checkout and order placement):
colinmollenhour/cache-backend-file
colinmollenhour/cache-backend-redis
phpseclib/mcrypt_compat
magento/module-elasticsearch-7
magento/theme-frontend-luma
magento/theme-adminhtml-backend
magento/module-mysql-mq
magento/module-offline-payments
magento/module-offline-shipping
Also, the whitelist supports wildcards:
vconnect/*
magento/*-graphql
Examples of command usage Project Analysis:
php src/vendor/bin/disassembling . --whitelist=colinmollenhour/cache-backend-file,colinmollenhour/cache-backend-redis,phpseclib/mcrypt_compat,magento/module-elasticsearch-7,magento/theme-frontend-luma,magento/theme-adminhtml-backend,magento/module-mysql-mq,magento/module-offline-payments,magento/module-offline-shipping
Project Analysis using a whitelist file:
php src/vendor/bin/disassembling . --whitelist=whitelist.txt
Extension Explain:
php src/vendor/bin/disassembling . --explain=magento/module-offline-payments --no-cache
Prefix usage:
php src/vendor/bin/disassembling . -e=magento/module-offline-payments -nc
Cache
By default, cache is enabled and stored in a [Magento root]/var/dependency-checker-cache.srz file with a 300 seconds lifetime.
Make sure to use --no-cache flag to disable cache usage when run with a new parameters.