Overview
A typical software development flow is as follows:
Local dev machine > QA/integration server > Preview server (optional) > Production server
Whether you are writing a new Magento 2 extension or contributing to the code base, the first step for any developer is setting up a development environment. This article will guide you in setting up and optimizing your local development machine. Local development machine
Your local development machine is where you develop and deploy your code to test it against a running Magento application. Its configuration should be as close to a production server as possible.
In your development machine, make sure you are running the Magento application in developer mode. You can enable this mode with the command bin/magento deploy:mode:set developer. Installation
The following is a list of the different ways you can install Magento 2 locally:
Manual installation
If you are developing on a local machine that meets the system requirements, you can follow the same steps as installing Magento on a production server.
Virtual Machine (VM) installation
Installing Magento 2 in a virtual environment allows you to run Magento 2 without the need to install a local LAMP stack.
VM tool
You can use a VM tool, such as VirtualBox, together with a virtual environment tool, such as Vagrant or Docker, to create reusable and shareable instances of Magento for development.
“magento developer box”
A search for “magento developer box” in GitHub provides a list of unofficial virtual machines configured for Magento development.
The following is a list of optimizations you can make on your local development machine
Bitte diese Befehle in der Konsole im Root Verseichnis ausführen!
Achtung
Bitte immer in der Konsole mit dem "Rechteinhaber" der Dateien verbinden, sonst kommt es zu unerwünschten Nebeneffekten!
Zeigt die aktuell installierte Version an.
php bin/magento --version
Den Magento Cache sollte man nach deploys oder Änderungen am Content leeren!
php -f ./bin/magento cache:clean
php -f ./bin/magento cache:flush
Neue oder eigene Module aktivien und Code generieren
php -f ./bin/magento setup:upgrade
php -f ./bin/magento setup:di:compile
php -f ./bin/magento setup:static-content:deploy -f
php -f ./bin/magento setup:static-content:deploy -f de_DE
Cache leeren!
php bin/magento setup:config:set --enable-debug-logging=true/false
php bin/magento cache:flush
php bin/magento setup:config:set --enable-syslog-logging=true/false
php bin/magento cache:flush
Das System in den Wartungsmodus versetzen.
php bin/magento maintenance:enable
Das "x" steht für die zu installierende Version. Statt der Community Edition kann man hier auch die Enterprise Version installieren.
composer require magento/product-community-edition 2.x.x --no-update
//oder
composer require magento/product-enterprise-edition=2.x.x --no-update
Führt das eigentliche Update durch.
composer update
rm -rf var/di var/generation
php bin/magento cache:flush
php bin/magento setup:upgrade
php bin/magento setup:di:compile
php bin/magento indexer:reindex
php bin/magento maintenance:disable
We recommend working in a development branch when adding an extension to your implementation. If you do not have a branch, see the Get started creating branches topic. When installing an extension, the extension name (_) is automatically inserted in the app/etc/config.php file. There is no need to edit the file directly.
To install an extension:
For example:
composer require pixlee/magento2:1.0.1 --no-update
Update the project dependencies.
Add, commit, and push code changes.
git add -A
git commit -m "Install <extension-name>"
git push origin <branch-name>
When installing an extension, you must include the composer.lock file when you push code changes to the remote environment. The composer install command reads the composer.lock file to enable the defined dependencies in the remote environment.
After the build and deploy finishes, use a SSH to log in to the remote environment and verify the extension installed.
bin/magento module:status <extension-name>
An extension name uses the format: <VendorName>_<ComponentName>
Sample response:
Module is enabled
If you encounter deployment errors, see extension deployment failure.
When you add an extension using Composer, the deployment process automatically enables the extension. If you already have the extension installed, you can enable or disable the extension using the CLI. When managing extensions, use the format: _. Never enable or disable an extension while logged in to the remote environments.
To enable or disable an extension:
$bin/magento module:enable <module-name>
$bin/magento module:disable <module-name>
$./vendor/bin/ece-tools module:refresh
$bin/magento module:status <module-name>
$git add -A
$git commit -m "Disable <extension-name>"
$git push origin <branch-names>
https://www.aheadworks.com/blog/magento-2-stock-inventory-tutorial/
https://devdocs.magento.com/guides/v2.3/extension-dev-guide/build/di-xml-file.html