A development environment is any copy of your site that operates separately from the live site. Development environments allow you to make changes, try new modules, write new code, and test new ideas, on a copy of your site instead of the real thing, ensuring those changes happen in a sandbox where you're not affecting anyone trying to use the live version of your application.
This is typically done by installing the server software required to run Drupal on your own computer and then creating a clone of your existing database and files. Or you might have a separate instance of the site setup on the existing infrastructure.
Here's a basic recipe for setting up a new development environment:
- Install web server, database server, PHP, and Git
- Either install Drupal if starting from scratch, or clone the code, database, and user-generated files from your live site
- Clear the cache
- Install Drupal on, or copy an existing site to, your computer to do development
- Test modules and code without affecting the production site
- Test server configuration changes on your localhost before deploying them to production
There are dozens of ways to do this, and none is the only right way. The bare minimum requirement is that you have PHP, a web server, and a database running on the computer where you would like to install Drupal. Beyond that, it's mostly personal preference.
- Installing a Local Development Server: This collection of tutorials includes instructions on how to set up a local development environment on Mac OS, Windows, and Linux.
- Create a Clone of Your Drupal Site
- Learn about why it's important to clone an existing site with Drupal 8. Then do it, either via the Command Line Interface (CLI), or with Graphical User Interface (GUI) tools.
- Using Git is an important part of the development workflow. Learn how to use Git to keep the code on your development environment in sync with that on the live site.
- Now that you've got a copy of your Drupal site on your local environment, using an IDE (Integrated Development Environment) such as PhpStorm can be highly useful, as it can autocomplete various language constructs, help you quickly locate inherited classes, alert you when a function is deprecated, provide debugging tools, and much more.