Categories: Magento 2 Tutorials

How to Run Dependency Reports in Magento 2

Magento 2 comes with many changes, and one of the major changes in Magento 2 is the usage of dependency injection and dependency report patterns. With these patterns, a lot has changed inside the codebase, and many new things have been introduced. In this article, I am going to talk about Dependency reports and how you can run them in Magento 2. In Magento 2, there are three types of dependencies reports, they are:
  1. Module dependencies: It shows the total number of dependencies among modules and whether the dependencies are hard or delicate.
  2. Circular dependencies: It shows the total number of dependency chains and circular dependency for modules.
  3. Framework dependencies: It shows the number of dependencies on the Magento 2 framework by a module.

Preparing To Run Dependency Reports

Before run dependency reports, you need to follow these steps:
    • Login to the Magento 2 server and switch to a user who has permissions to write Magento 2 file system.
    • Open your SSH terminal and use the following command to switch to the Magento 2 file system owner:
find . -type d -exec chmod 770 {} \; && find . -type f -exec chmod 660 {} \; && chmod u+x bin/magento
export PATH=$PATH:$(pwd)/bin

Run Dependency Reports

For running the dependency reports on your Magento 2, use this following command:
magento info:dependencies:{show-modules|show-modules-circular|show-framework} [-d|--directory=""] [-o|--output="
Confused as to what these commands mean? Here are the meanings of this commands options, values, and parameters:
  • show-modules: This Parameter is required for getting module dependencies report.
  • show-modules-circular: This Parameter is required for getting Circular dependencies report.
  • show-framework: This Parameter is required for getting Framework dependencies report.

Module Dependencies Report

Below is the output for a module dependencies report:
"","All","Hard","Soft"
"Total number of dependencies","602","587","15"
"Dependencies for each module:","All","Hard","Soft"
"magento/module-cron","2","2","0"
" -- magento/module-config","","1","0"
" -- magento/module-store","","1","0"
"magento/module-catalog-rule","8","8","0"
" -- magento/module-store","","1","0"
" -- magento/module-rule","","1","0"
" -- magento/module-catalog","","1","0"
" -- magento/module-customer","","1","0"
" -- magento/module-backend","","1","0"
" -- magento/module-eav","","1","0"
" -- magento/module-indexer","","1","0"
" -- magento/module-import-export","","1","0"

Circular Dependencies Reports:

Below is the output for a circular dependencies report:
"Circular dependencies:","Total number of chains"
"","848"
"Circular dependencies for each module:",""
"magento/module-config","70"
"magento/module-config->magento/module-store->magento/module-directory->magento/module-config"
"magento/module-config->magento/module-store->magento/module-config"
"magento/module-config->magento/module-cron->magento/module-config"
"magento/module-config->magento/module-email->magento/module-config"
"magento/module-config->magento/module-backend->magento/module-theme->magento/module-customer->magento/module-eav->magento/module-config"
"magento/module-config->magento/module-backend->magento/module-reports->magento/module-config"
"magento/module-config->magento/module-backend->magento/module-sales->magento/module-catalog->magento/module-theme->magento/module-eav->magento/module-config"
"magento/module-config->magento/module-backend->magento/module-sales->magento/module-catalog->magento/module-log->magento/module-eav->magento/module-config"
"magento/module-config->magento/module-backend->magento/module-sales->magento/module-customer->magento/module-checkout->magento/module-catalog-inventory->magento/module-config"
"magento/module-config->magento/module-backend->magento/module-sales->magento/module-customer->magento/module-checkout->magento/module-config"
"magento/module-config->magento/module-backend->magento/module-sales->magento/module-customer->magento/module-theme->magento/module-config"
"magento/module-config->magento/module-backend->magento/module-sales->magento/module-payment->magento/module-config"
"magento/module-config->magento/module-backend->magento/module-sales->magento/module-checkout->magento/module-customer->magento/module-review->magento/module-catalog->magento/module-themeax->magento/module-config"
"magento/module-config->magento/module-backend->magento/module-sales->magento/module-checkout->magento/module-customer->magento/module-review->magento/module-catalog->magento/module-catalog-rule->magento/module-rule->magento/module-eav->magento/module-config"

Framework Dependencies Reports:

Below is the output for a framework dependencies report:
"Dependencies of framework:","Total number"
"","111"
"Dependencies for each module:",""
"Magento\Cron","1"
" -- Magento\Framework","143"
"Magento\CatalogRule","1"
" -- Magento\Framework","234"
"Magento\Webapi","2"
" -- Magento\Framework","347"
" -- Magento\Server","1"
"Magento\Checkout","1"
" -- Magento\Framework","759"
"Magento\Reports","1"
" -- Magento\Framework","553"

Final Thoughts

This is just a short tutorial on how to run and prepare your Magento 2 framework for dependencies. I’m sure with this tutorial you can easily run dependencies report on your Magento 2 server. If you face any problems, leave your comment in the section below.
AbdurRahman Lakhani

Abdur Rahman is the Marketing Manager & Magento expert at Magenticians. He is growth ambitious and aims to learn & share information about Ecommerce & Magento Development through practice and experimentation. He loves to travel and explores new ideas whenever he finds time.

Share
Published by
AbdurRahman Lakhani

Recent Posts

Building Employee Trust and Dedication – A Complete Guide

In the highly competitive modern workplace, trust, and employee loyalty are crucial factors for long-term… Read More

3 months ago

12 Winning Strategies for Small Businesses Marketing

In the ever-evolving world of small business developing and implementing effective marketing strategies is critical to… Read More

3 months ago

Top 10 App Development Companies in Dubai 2024

With one of the highest internet penetration rates, the UAE has set out to revolutionize… Read More

3 months ago

Transforming Industries: How Amazons GPT44X is Revolutionizing AI Technology

Artificial Intelligence (AI) has been continually evolving, leading to remarkable advancements in various industries. Among… Read More

8 months ago

Top Magento 2 Extensions for 2023

Extensions, extensions and lots of extensions. We all love extensions, don’t we? After all, extensions… Read More

11 months ago

Unleashing the Power of Software Testing: Cooperating with a Testing Firm

Software quality is crucial to a firm's success across industries in the quickly changing digital… Read More

11 months ago