Showing results for 
Search instead for 
Did you mean: 

How to publish Magento Extension with Two folders?

How to publish Magento Extension with Two folders?

Hi All, 

How are you doing people?


We have created a Magento Extension that consists of two key folders: one dedicated to managing the admin-side functionalities, enabling administrators to configure product settings, and another for the front end, catering to the e-commerce product page experience for customers.

In the process of submitting the extension, I attempted to include the Archive  compose.json and register.php files within the backend folder located in the root directory. However, I encountered an error message stating, "Failed to open the compose.json file."

Is there anything else I can help you with regarding this issue?



Anup Tilak


Re: How to publish Magento Extension with Two folders?



It seems like you encountered an issue with your composer.json file when trying to include it within the backend folder of your Magento extension. The error message "Failed to open the composer.json file" suggests that Magento is unable to locate or open the composer.json file in the specified directory.


To resolve this issue, here are a few steps you can follow:


Ensure Correct File Placement:


Double-check that you have placed the composer.json file in the correct location within your extension's directory structure. The composer.json file should be in the root directory of your extension, not inside a specific folder.


Example directory structure:
├── composer.json
├── Module1
│ ├── ... (Module1 files)
├── Module2
│ ├── ... (Module2 files)



Check File Permissions:


Ensure that the composer.json file has the correct file permissions to be read by Magento. You may need to adjust file permissions if they are restrictive. You can use the chmod command to modify file permissions.


Validate JSON Format:


Make sure that your composer.json file is correctly formatted as valid JSON. Even a small syntax error can prevent it from being read. You can use online JSON validators or tools like jsonlint to check the validity of your composer.json file.


Review Magento Version and Requirements:


Verify that the Magento version specified in your composer.json file is correct and compatible with your extension. Ensure that any dependencies or requirements mentioned in the composer.json file are accurate and up-to-date.


Rebuild Composer Autoload Files:


If you've made any changes to the file structure, you might need to regenerate the Composer autoload files. Run the following commands from your Magento root directory:



composer dump-autoload
bin/magento setup:upgrade
bin/magento setup:di:compile
bin/magento setup:static-content:deploy



Check for Typos and Case Sensitivity:


Ensure that the file names are case-sensitive and accurately spelled. Typos in file names or incorrect capitalization can lead to errors.


If you continue to face issues, please provide more details about your composer.json file, the directory structure of your extension, and any specific error messages you receive. This information will help in diagnosing the problem more accurately and providing a solution. If you still have any queries you can contact us. We would like to assist you.