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:

Run Dependency Reports

For running the dependency reports on your Magento 2, use this following command:

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:

Circular Dependencies Reports:

Below is the output for a circular dependencies report:

Framework Dependencies Reports:

Below is the output for a framework dependencies report:

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.