All Magento CLI commands must be run by the file system owner.
Code compilation includes the following (in no particular order):
You can find code compilation classes in the \Magento\Setup\Module\Di\App\Task\Operation namespace.
To run the single-tenant compiler:
bin/magento setup:di:compile
Generated code and dependency injection configuration successfully.
To compile code before installing the Commerce application:
In some cases, you might want to compile code before you install the Commerce application.
Enable the modules.
bin/magento module:enable --all [-c|--clear-static-content]
Use the [-c|--clear-static-content]
option to clear static content. This is necessary if you previously enabled or disabled modules and you must clear the static content previously generated for them.
See Enable modules.
Compile the code.
bin/magento setup:di:compile
Generated code and dependency injection configuration successfully.
To compile code without a database, see Deploy static view files without installing Magento.