Uncovering Custom Extensions and Versions in Magento 2 Projects

In Magento 2, custom extensions play a crucial role in enhancing functionality and extending the capabilities of online stores. However, keeping track of these extensions and their respective versions can become challenging, especially in larger projects. In this blog post, we will explore a code snippet that allows you to effortlessly extract the names and versions of custom extensions from any Magento 2 project.

To find all third-party or we can say custom extensions with paths and their versions from any project,

Run this code directly in any Magento 2 project’s root directory :

The provided code utilizes shell scripting to extract information from a Magento 2 installation’s app/etc/config.php file and module.xml files. Let’s break down the steps:

  1. Looping through app/etc/config.php:
    • The code initiates a loop to read the config.php file, which contains the configuration settings for installed modules.
  2. Extracting custom module names:
    • Within the loop, the code employs a grep command to extract module names (excluding Magento core modules) from the config.php file. These names represent custom extensions in the Magento 2 project.
  3. Sorting module names:
    • The extracted module names are sorted alphabetically using the sort the command for easier readability and organization.
  4. Retrieving module versions:
    • For each custom module, the code reads the module.xml files within the project’s vendor/ and app/code/ directories.
    • It uses another grep command to find the version information specified in the module.xml files for each module.
  5. Displaying the results:
    • Finally, the code outputs the module names and their corresponding versions in a user-friendly format.

Output :

Leave a Reply

Your email address will not be published. Required fields are marked *