Magento 2.1.18 is the final 2.1.x release. After June 2019, Magento 2.1.x will no longer receive security patches, quality fixes, or documentation updates.
To maintain your site's performance, security, and PCI compliance, upgrade to the latest version of Magento.

Optimal Development Environment

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.

    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.

    A search for “magento developer box” in GitHub provides a list of unofficial virtual machines configured for Magento development.

Optimal Configuration

The following is a list of optimizations you can make on your local development machine

  • Magento recommends installing and using the latest supported version of PHP 7 to increase performance.
  • Replace your MySQL database with Percona.
  • Make sure you install and enable PHP OPcache.
  • Xdebug is off by default. Enable this feature only when you need it because it requires a lot of memory and degrades performance. The xdebug.max_nesting_level configuration needs to be set to 200 or greater for Magento. You can increase the memory available to PHP to get an increase in performance with Xdebug on.
  • If you need sample data, you can install it using composer or by cloning repositories.
  • To speed up frontend development, turn off merging of CSS and JavaScript.
  • Make sure caching is turned on (this is the default behavior). Generally, only page cache and block cache should be turned off for development and turned back on when testing.
  • Opcache timestamp validation should always be on for development. Development is impossible with opcache on and revalidation off because any PHP modification would require a cache reset.
Updated