cancel
Showing results for 
Search instead for 
Did you mean: 

Do I install custom extension into /vendor or /app/code?

SOLVED

Do I install custom extension into /vendor or /app/code?

We are developing a Magento 2.4.x website with the following:

 

- Custom developed theme, installed using Composer to /vendor

- 10+ third party extensions installed using Composer to /vendor (such as BSS Commerce One Page Checkout)

 

We are now developing our own extension which modifies both Magento 2 core files and also files within third party extensions.

 

Because we are overriding third party extensions installed in /vendor, do we need to install our custom extension in /app/code or can we also install this using Composer into /vendor?

 

Thanks,

Matt

1 ACCEPTED SOLUTION

Accepted Solutions

Re: Do I install custom extension into /vendor or /app/code?

@matt_ryding 

Yes, it is okay to install the module using composer on the vendor. Since all override files are already mentioned in di.xml, no conflict occurred on both the original and override module..



If my answer is useful please accept as a solution and give Kudo
Thank you.

View solution in original post

4 REPLIES 4

Re: Do I install custom extension into /vendor or /app/code?

Hey @matt_ryding... 

Magento 2 use composer for managing modules, when you install a module through composer it is added to vendor/<vendor-name>/<module>.

You should not edit any code inside the vendor folder. If you’re developing your own module or if you want to continue the development of an existing module, add your files or clone a git repo to app/code/<vendor-name>/<module>.

If my answer is useful please accept as a solution and give Kudo
Thank You

 

Re: Do I install custom extension into /vendor or /app/code?

Hey @harshityadav 

 

Thanks for your update below.

 

I confirm that we are not modifying any code inside /vendor folder, maybe I have used the wrong terms for this.

 

We are continuing the development of an existing module and our development server stores our own module in app/code.

 

But, on our production server I would like to manage our module using Composer, which means it will be placed in /vendor.

 

Will this be OK, as our module extends an existing module which is also installed using Composer into /vendor?

Re: Do I install custom extension into /vendor or /app/code?

@matt_ryding 

Yes, it is okay to install the module using composer on the vendor. Since all override files are already mentioned in di.xml, no conflict occurred on both the original and override module..



If my answer is useful please accept as a solution and give Kudo
Thank you.

View solution in original post

Re: Do I install custom extension into /vendor or /app/code?

@harshityadav 

 

Thank you very much, this is great to know and answers my question..