If this question has been answered elsewhere I will delete this one. From a good look around, there doesn't seem to be a solid answer.

When I am developing an extension for Magento 2(.1), do I have to run php magento setup:di:compile every time a change is made to the di.xml?

Also, when is the appropriate time to run this command?


Yes you will need to run bin/magento setup:di:compile everytime when you added new classes with dependencies (constructor parameters) or changed dependencies of existing classes.(di.xml)

Another main thing here is Code compilation. setup:di:compile command compiles your code everytime. its compile the code and check is there any error in that code or not , if error is there it will show directly on the command prompt in red color.

While developing your extension in magento 2 and upper versions whenever you change any custom logic or some front end side operations there is no need to run this command . But if you change something in either di.xml or class ,factory method etc etc ... then you must need to run this command.

Refer this link for more details - http://devdocs.magento.com/guides/v2.0/config-guide/cli/config-cli-subcommands-compiler.html

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.