Should new modules be developed in app/code or vendor/org/module?Merge changes from remote magento repos get abortingCustom router in module “Sample New Page” wont workHow to pull in Magento 2 dev change into standard releaseTransfer multi-website content between staging and productionManaging M2 projects with GIT (workflow)Magento2 - local / staging / production deployment & gitignoreIssue with installing new module for adding custom attribute into category section magento 2Magento 2 Module Install With Composer going to Vendor Folder,How to install on ServerMagento 2 InvalidArgumentException Could not find a matching version of packageDeveloped Module
Why does Mind Blank stop the Feeblemind spell?
Apply MapThread to all but one variable
Like totally amazing interchangeable sister outfits II: The Revenge
a sore throat vs a strep throat vs strep throat
Mistake in years of experience in resume?
What term is being referred to with "reflected-sound-of-underground-spirits"?
Aliens crash on Earth and go into stasis to wait for technology to fix their ship
Why do games have consumables?
Why didn't the Space Shuttle bounce back into space as many times as possible so as to lose a lot of kinetic energy up there?
555 timer FM transmitter
What happened to Captain America in Endgame?
How to not starve gigantic beasts
What makes accurate emulation of old systems a difficult task?
How could Tony Stark make this in Endgame?
Re-entry to Germany after vacation using blue card
How can Republicans who favour free markets, consistently express anger when they don't like the outcome of that choice?
Pre-plastic human skin alternative
How do I check if a string is entirely made of the same substring?
Was there a shared-world project before "Thieves World"?
Map of water taps to fill bottles
How to limit Drive Letters Windows assigns to new removable USB drives
Could the terminal length of components like resistors be reduced?
Don’t seats that recline flat defeat the purpose of having seatbelts?
Minor Revision with suggestion of an alternative proof by reviewer
Should new modules be developed in app/code or vendor/org/module?
Merge changes from remote magento repos get abortingCustom router in module “Sample New Page” wont workHow to pull in Magento 2 dev change into standard releaseTransfer multi-website content between staging and productionManaging M2 projects with GIT (workflow)Magento2 - local / staging / production deployment & gitignoreIssue with installing new module for adding custom attribute into category section magento 2Magento 2 Module Install With Composer going to Vendor Folder,How to install on ServerMagento 2 InvalidArgumentException Could not find a matching version of packageDeveloped Module
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I prefer creating a new module repo in git, adding that via composer, and letting composer check it out to vendor
so that I can develop in <magento-root>/vendor/[org]/[module]
from start to finish and my local environment matches production as much as possible.
However, the Magento docs suggest starting a new module in <magento-root>/app/code/
. I'm trying to understand different workflows, so are any benefits to doing it that way that I'm missing?
magento2 module third-party-module
New contributor
add a comment |
I prefer creating a new module repo in git, adding that via composer, and letting composer check it out to vendor
so that I can develop in <magento-root>/vendor/[org]/[module]
from start to finish and my local environment matches production as much as possible.
However, the Magento docs suggest starting a new module in <magento-root>/app/code/
. I'm trying to understand different workflows, so are any benefits to doing it that way that I'm missing?
magento2 module third-party-module
New contributor
if module is in vendor folder then It can be updated by composer.
– Aaditya
Apr 23 at 15:36
composer is a package management tool. Any external modules/packages which constitutes your Magento application will be managed by the composer and will be available under vendor directory, provided you have adopted the composer way of installation/ updating of your Magento instance. Magento core modules are also treated as external packages which constitute your Magento application.
– Aaditya
Apr 23 at 15:36
add a comment |
I prefer creating a new module repo in git, adding that via composer, and letting composer check it out to vendor
so that I can develop in <magento-root>/vendor/[org]/[module]
from start to finish and my local environment matches production as much as possible.
However, the Magento docs suggest starting a new module in <magento-root>/app/code/
. I'm trying to understand different workflows, so are any benefits to doing it that way that I'm missing?
magento2 module third-party-module
New contributor
I prefer creating a new module repo in git, adding that via composer, and letting composer check it out to vendor
so that I can develop in <magento-root>/vendor/[org]/[module]
from start to finish and my local environment matches production as much as possible.
However, the Magento docs suggest starting a new module in <magento-root>/app/code/
. I'm trying to understand different workflows, so are any benefits to doing it that way that I'm missing?
magento2 module third-party-module
magento2 module third-party-module
New contributor
New contributor
New contributor
asked Apr 23 at 15:10
Keith BentrupKeith Bentrup
1263
1263
New contributor
New contributor
if module is in vendor folder then It can be updated by composer.
– Aaditya
Apr 23 at 15:36
composer is a package management tool. Any external modules/packages which constitutes your Magento application will be managed by the composer and will be available under vendor directory, provided you have adopted the composer way of installation/ updating of your Magento instance. Magento core modules are also treated as external packages which constitute your Magento application.
– Aaditya
Apr 23 at 15:36
add a comment |
if module is in vendor folder then It can be updated by composer.
– Aaditya
Apr 23 at 15:36
composer is a package management tool. Any external modules/packages which constitutes your Magento application will be managed by the composer and will be available under vendor directory, provided you have adopted the composer way of installation/ updating of your Magento instance. Magento core modules are also treated as external packages which constitute your Magento application.
– Aaditya
Apr 23 at 15:36
if module is in vendor folder then It can be updated by composer.
– Aaditya
Apr 23 at 15:36
if module is in vendor folder then It can be updated by composer.
– Aaditya
Apr 23 at 15:36
composer is a package management tool. Any external modules/packages which constitutes your Magento application will be managed by the composer and will be available under vendor directory, provided you have adopted the composer way of installation/ updating of your Magento instance. Magento core modules are also treated as external packages which constitute your Magento application.
– Aaditya
Apr 23 at 15:36
composer is a package management tool. Any external modules/packages which constitutes your Magento application will be managed by the composer and will be available under vendor directory, provided you have adopted the composer way of installation/ updating of your Magento instance. Magento core modules are also treated as external packages which constitute your Magento application.
– Aaditya
Apr 23 at 15:36
add a comment |
2 Answers
2
active
oldest
votes
In my development environments I try to treat the vendor directory as read-only and the property of composer. Although you can of course, my rule is that you don't in normal circumstances edit the vendor files. The first reason is that it's at least possible for a composer update to clobber your local changes. The second reason is that it simplifies your workflow to know that the composer files are in a settled state so you don't need to look there for changes or bugs. I usually have file permissions set in a way that they're not convenient to edit.
The flow should be: develop the module in app/code/ in dev, and then get it to the next done state and submit it to composer. Getting it to production is then a matter of a composer require/update on the production server. That way you know that production doesn't have any surprise new changes since the last incremental release.
There are no differences from Magento's perspective between having the code in app/code or in /vendor. It works the same. Not sure why it's a benefit to you to have the file systems in dev and production match.
add a comment |
I'll post my thoughts on the benefits of developing under vendor via a git repo in composer.json instead of app/code ...
Primarily, I don't have to think about where my code resides in dev vs. integration vs. production. It's always in the same place, organized/managed by composer. This simplifies many common developer tasks. For example,
Searching - If I'm searching on a string across the code base, I can just grep/ack in ./vendor. I don't have to search in app/code and vendor, or from a common root dir and search perhaps many unwanted dir. Similarly, for find, whether I'm looking for all cron_tab.xml files or all js files, I just have to look in vendor.
Debugging - I don't have to map different paths in my IDE for debugging in dev vs. integration vs. production. Once again it's always in vendor using a consistent path - not certain paths are in one dir and others are in a different dir depending upon the stage.
Patch files - If I'm deploying to Magento cloud and applying a patch/hotfix, my generated paths will always be correct. I won't have to create a patch file, and then update the paths.
Composer scripts (pre|post-autoload-dump, post-install-cmd, etc.) - since I keep those scripts in a composer module, when referencing them in composer.json, I don't have to update their paths for the different stages.
Shell cmds, cli snippets, etc. in a terminal - if the paths are the same, I can run them in the same way with a simple cut and paste in every stage.
Finding differences between dev vs. integration vs. productions becomes as simple as
scp/rsync
anddiff -r
(or any other gui diff tool)
What hasn't been a problem for me - composer clobbering my files. I'm not often running composer update while I'm actively developing a module. However, I am frequently committing my code, so it's in git if something should happen. Also, composer will always alert you to changes that could be clobbered, and you have to assert affirmatively that you want composer to overwrite those changes. Lastly, any code that I'm actively working on is also usually open in my IDE, too. If it detects a change, it'll ask me if I want to load the new or old. I'm not sure that I've ever lost code to composer clobbering, but yes, it could happen.
New contributor
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "479"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Keith Bentrup is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f271123%2fshould-new-modules-be-developed-in-app-code-or-vendor-org-module%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
In my development environments I try to treat the vendor directory as read-only and the property of composer. Although you can of course, my rule is that you don't in normal circumstances edit the vendor files. The first reason is that it's at least possible for a composer update to clobber your local changes. The second reason is that it simplifies your workflow to know that the composer files are in a settled state so you don't need to look there for changes or bugs. I usually have file permissions set in a way that they're not convenient to edit.
The flow should be: develop the module in app/code/ in dev, and then get it to the next done state and submit it to composer. Getting it to production is then a matter of a composer require/update on the production server. That way you know that production doesn't have any surprise new changes since the last incremental release.
There are no differences from Magento's perspective between having the code in app/code or in /vendor. It works the same. Not sure why it's a benefit to you to have the file systems in dev and production match.
add a comment |
In my development environments I try to treat the vendor directory as read-only and the property of composer. Although you can of course, my rule is that you don't in normal circumstances edit the vendor files. The first reason is that it's at least possible for a composer update to clobber your local changes. The second reason is that it simplifies your workflow to know that the composer files are in a settled state so you don't need to look there for changes or bugs. I usually have file permissions set in a way that they're not convenient to edit.
The flow should be: develop the module in app/code/ in dev, and then get it to the next done state and submit it to composer. Getting it to production is then a matter of a composer require/update on the production server. That way you know that production doesn't have any surprise new changes since the last incremental release.
There are no differences from Magento's perspective between having the code in app/code or in /vendor. It works the same. Not sure why it's a benefit to you to have the file systems in dev and production match.
add a comment |
In my development environments I try to treat the vendor directory as read-only and the property of composer. Although you can of course, my rule is that you don't in normal circumstances edit the vendor files. The first reason is that it's at least possible for a composer update to clobber your local changes. The second reason is that it simplifies your workflow to know that the composer files are in a settled state so you don't need to look there for changes or bugs. I usually have file permissions set in a way that they're not convenient to edit.
The flow should be: develop the module in app/code/ in dev, and then get it to the next done state and submit it to composer. Getting it to production is then a matter of a composer require/update on the production server. That way you know that production doesn't have any surprise new changes since the last incremental release.
There are no differences from Magento's perspective between having the code in app/code or in /vendor. It works the same. Not sure why it's a benefit to you to have the file systems in dev and production match.
In my development environments I try to treat the vendor directory as read-only and the property of composer. Although you can of course, my rule is that you don't in normal circumstances edit the vendor files. The first reason is that it's at least possible for a composer update to clobber your local changes. The second reason is that it simplifies your workflow to know that the composer files are in a settled state so you don't need to look there for changes or bugs. I usually have file permissions set in a way that they're not convenient to edit.
The flow should be: develop the module in app/code/ in dev, and then get it to the next done state and submit it to composer. Getting it to production is then a matter of a composer require/update on the production server. That way you know that production doesn't have any surprise new changes since the last incremental release.
There are no differences from Magento's perspective between having the code in app/code or in /vendor. It works the same. Not sure why it's a benefit to you to have the file systems in dev and production match.
answered Apr 23 at 17:44
S AdamsonS Adamson
1168
1168
add a comment |
add a comment |
I'll post my thoughts on the benefits of developing under vendor via a git repo in composer.json instead of app/code ...
Primarily, I don't have to think about where my code resides in dev vs. integration vs. production. It's always in the same place, organized/managed by composer. This simplifies many common developer tasks. For example,
Searching - If I'm searching on a string across the code base, I can just grep/ack in ./vendor. I don't have to search in app/code and vendor, or from a common root dir and search perhaps many unwanted dir. Similarly, for find, whether I'm looking for all cron_tab.xml files or all js files, I just have to look in vendor.
Debugging - I don't have to map different paths in my IDE for debugging in dev vs. integration vs. production. Once again it's always in vendor using a consistent path - not certain paths are in one dir and others are in a different dir depending upon the stage.
Patch files - If I'm deploying to Magento cloud and applying a patch/hotfix, my generated paths will always be correct. I won't have to create a patch file, and then update the paths.
Composer scripts (pre|post-autoload-dump, post-install-cmd, etc.) - since I keep those scripts in a composer module, when referencing them in composer.json, I don't have to update their paths for the different stages.
Shell cmds, cli snippets, etc. in a terminal - if the paths are the same, I can run them in the same way with a simple cut and paste in every stage.
Finding differences between dev vs. integration vs. productions becomes as simple as
scp/rsync
anddiff -r
(or any other gui diff tool)
What hasn't been a problem for me - composer clobbering my files. I'm not often running composer update while I'm actively developing a module. However, I am frequently committing my code, so it's in git if something should happen. Also, composer will always alert you to changes that could be clobbered, and you have to assert affirmatively that you want composer to overwrite those changes. Lastly, any code that I'm actively working on is also usually open in my IDE, too. If it detects a change, it'll ask me if I want to load the new or old. I'm not sure that I've ever lost code to composer clobbering, but yes, it could happen.
New contributor
add a comment |
I'll post my thoughts on the benefits of developing under vendor via a git repo in composer.json instead of app/code ...
Primarily, I don't have to think about where my code resides in dev vs. integration vs. production. It's always in the same place, organized/managed by composer. This simplifies many common developer tasks. For example,
Searching - If I'm searching on a string across the code base, I can just grep/ack in ./vendor. I don't have to search in app/code and vendor, or from a common root dir and search perhaps many unwanted dir. Similarly, for find, whether I'm looking for all cron_tab.xml files or all js files, I just have to look in vendor.
Debugging - I don't have to map different paths in my IDE for debugging in dev vs. integration vs. production. Once again it's always in vendor using a consistent path - not certain paths are in one dir and others are in a different dir depending upon the stage.
Patch files - If I'm deploying to Magento cloud and applying a patch/hotfix, my generated paths will always be correct. I won't have to create a patch file, and then update the paths.
Composer scripts (pre|post-autoload-dump, post-install-cmd, etc.) - since I keep those scripts in a composer module, when referencing them in composer.json, I don't have to update their paths for the different stages.
Shell cmds, cli snippets, etc. in a terminal - if the paths are the same, I can run them in the same way with a simple cut and paste in every stage.
Finding differences between dev vs. integration vs. productions becomes as simple as
scp/rsync
anddiff -r
(or any other gui diff tool)
What hasn't been a problem for me - composer clobbering my files. I'm not often running composer update while I'm actively developing a module. However, I am frequently committing my code, so it's in git if something should happen. Also, composer will always alert you to changes that could be clobbered, and you have to assert affirmatively that you want composer to overwrite those changes. Lastly, any code that I'm actively working on is also usually open in my IDE, too. If it detects a change, it'll ask me if I want to load the new or old. I'm not sure that I've ever lost code to composer clobbering, but yes, it could happen.
New contributor
add a comment |
I'll post my thoughts on the benefits of developing under vendor via a git repo in composer.json instead of app/code ...
Primarily, I don't have to think about where my code resides in dev vs. integration vs. production. It's always in the same place, organized/managed by composer. This simplifies many common developer tasks. For example,
Searching - If I'm searching on a string across the code base, I can just grep/ack in ./vendor. I don't have to search in app/code and vendor, or from a common root dir and search perhaps many unwanted dir. Similarly, for find, whether I'm looking for all cron_tab.xml files or all js files, I just have to look in vendor.
Debugging - I don't have to map different paths in my IDE for debugging in dev vs. integration vs. production. Once again it's always in vendor using a consistent path - not certain paths are in one dir and others are in a different dir depending upon the stage.
Patch files - If I'm deploying to Magento cloud and applying a patch/hotfix, my generated paths will always be correct. I won't have to create a patch file, and then update the paths.
Composer scripts (pre|post-autoload-dump, post-install-cmd, etc.) - since I keep those scripts in a composer module, when referencing them in composer.json, I don't have to update their paths for the different stages.
Shell cmds, cli snippets, etc. in a terminal - if the paths are the same, I can run them in the same way with a simple cut and paste in every stage.
Finding differences between dev vs. integration vs. productions becomes as simple as
scp/rsync
anddiff -r
(or any other gui diff tool)
What hasn't been a problem for me - composer clobbering my files. I'm not often running composer update while I'm actively developing a module. However, I am frequently committing my code, so it's in git if something should happen. Also, composer will always alert you to changes that could be clobbered, and you have to assert affirmatively that you want composer to overwrite those changes. Lastly, any code that I'm actively working on is also usually open in my IDE, too. If it detects a change, it'll ask me if I want to load the new or old. I'm not sure that I've ever lost code to composer clobbering, but yes, it could happen.
New contributor
I'll post my thoughts on the benefits of developing under vendor via a git repo in composer.json instead of app/code ...
Primarily, I don't have to think about where my code resides in dev vs. integration vs. production. It's always in the same place, organized/managed by composer. This simplifies many common developer tasks. For example,
Searching - If I'm searching on a string across the code base, I can just grep/ack in ./vendor. I don't have to search in app/code and vendor, or from a common root dir and search perhaps many unwanted dir. Similarly, for find, whether I'm looking for all cron_tab.xml files or all js files, I just have to look in vendor.
Debugging - I don't have to map different paths in my IDE for debugging in dev vs. integration vs. production. Once again it's always in vendor using a consistent path - not certain paths are in one dir and others are in a different dir depending upon the stage.
Patch files - If I'm deploying to Magento cloud and applying a patch/hotfix, my generated paths will always be correct. I won't have to create a patch file, and then update the paths.
Composer scripts (pre|post-autoload-dump, post-install-cmd, etc.) - since I keep those scripts in a composer module, when referencing them in composer.json, I don't have to update their paths for the different stages.
Shell cmds, cli snippets, etc. in a terminal - if the paths are the same, I can run them in the same way with a simple cut and paste in every stage.
Finding differences between dev vs. integration vs. productions becomes as simple as
scp/rsync
anddiff -r
(or any other gui diff tool)
What hasn't been a problem for me - composer clobbering my files. I'm not often running composer update while I'm actively developing a module. However, I am frequently committing my code, so it's in git if something should happen. Also, composer will always alert you to changes that could be clobbered, and you have to assert affirmatively that you want composer to overwrite those changes. Lastly, any code that I'm actively working on is also usually open in my IDE, too. If it detects a change, it'll ask me if I want to load the new or old. I'm not sure that I've ever lost code to composer clobbering, but yes, it could happen.
New contributor
New contributor
answered Apr 23 at 23:40
Keith BentrupKeith Bentrup
1263
1263
New contributor
New contributor
add a comment |
add a comment |
Keith Bentrup is a new contributor. Be nice, and check out our Code of Conduct.
Keith Bentrup is a new contributor. Be nice, and check out our Code of Conduct.
Keith Bentrup is a new contributor. Be nice, and check out our Code of Conduct.
Keith Bentrup is a new contributor. Be nice, and check out our Code of Conduct.
Thanks for contributing an answer to Magento Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f271123%2fshould-new-modules-be-developed-in-app-code-or-vendor-org-module%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
if module is in vendor folder then It can be updated by composer.
– Aaditya
Apr 23 at 15:36
composer is a package management tool. Any external modules/packages which constitutes your Magento application will be managed by the composer and will be available under vendor directory, provided you have adopted the composer way of installation/ updating of your Magento instance. Magento core modules are also treated as external packages which constitute your Magento application.
– Aaditya
Apr 23 at 15:36