A Drupal Development Environment on Windows

As Drupal developers we're always learning new tricks of the trade, be it modules, hooks, theme functions, or simply a new feature implementation. With all of the information online centered around Drupal code, there is surprisingly little to be found regarding the tools used to develop it. In this post I will break down my personal Drupal development environment, and the various tools I use in day to day development.

I have two different machines in my arsenal - a Macbook Pro for remote work, and a dual booting Windows/Ubuntu machine in the office. While I love the OS X and Linux experience, my primary system is Windows. Now, I'll be the first to say that there are some immediate and obvious disadvantages to using Windows as a development environment. Lack of a UNIX terminal for one, poor support for relevant technologies for another. That said, with every problem comes a solution.

These are the main tools you will use in your every day Drupal development workflow:

  • Web browser
  • Code editor
  • Command line interface
  • Version control system
  • FTP client
  • LAMP stack
  • Graphics editor

Web browser

A good web browser will make your life easier, but in reality you likely need to test your work across all major browsers anyway, so just choose what you prefer. I personally stick with Google Chrome for the majority of my work. Google Chrome includes a built in web inspector (F12), which is a must for front-end development. I use the ColorZilla extension for easy rgb/hex color selection, and Awesome Screenshot to capture parts or all of the page for mock-up or client review. The Web Developer toolbar is another handy extension that helps you alter page assets and display additional information.

Code editor

When it comes to setting up a new development environment, choosing a suitable code editor is one of the most important decisions you can make. A good code editor will increase your speed and efficiency over time, while a poor editor will do the opposite. I have tried dozens of different editors over the years and believe I have arrived at the perfect tool for my needs: Sublime Text. My main criteria for a code editor are: cross platform, keyboard driven, highly customizable, and good community support. Sublime Text fits the bill.

Out of the box Sublime Text seems slightly feature-poor, but don't fret - like Drupal, Sublime Text is highly extensible by way of its powerful Python based plugin API. For my Drupal development environment I rely heavily on the following plugins: Package Control, SublimeCodeIntel, SublimeLinter, SublimeLinter-php, Drupal, Drupal Completions, Goto Drupal API, BracketHighlighter, jQuery, PhpDoc, Git, SFTP, SideBarEnhancements.

In addition to the above plugins, I also run the following custom user configuration:

{
  "bold_folder_labels": true,
  "caret_style": "wide",
  "default_line_ending": "unix",
  "drag_text": false,
  "ensure_newline_at_eof_on_save": true,
  "fallback_encoding": "UTF-8",
  "find_selected_text": true,
  "highlight_line": true,
  "line_padding_bottom": 1,
  "open_files_in_new_window": false,
  "shift_tab_unindent": true,
  "tab_size": 2,
  "translate_tabs_to_spaces": true,
  "trim_automatic_white_space": true,
  "trim_trailing_white_space_on_save": true,
  "use_tab_stops": true
}

Command line interface

If you're on a Mac or Linux machine, you're probably already familiar with the terminal. If you're on a Windows machine however, get ready for some pain. Windows does not have a native UNIX style terminal (and no, PowerShell is not a suitable replacement). Luckily there is a solution, though it still leaves something to be desired. Cygwin is an open source CLI which attempts to replicate the Unix terminal on Windows. Obviously this is not nearly as powerful as a real UNIX shell, but it will get the job done in 99% of cases. I use Cygwin for Git, Drush, and SSH, primarily. You can of course also install Git, Drush, and SSH on Windows and access them via the command prompt, though I find Windows command syntax to be clunky and in all honesty I'm just a lot faster in a real shell. The choice to use Cygwin or Command will come down to your own personal preference.

Version control system

Version control is a necessity for modern development, and has saved my hide on more than one occasion. The concept of a VCS is simple: every change to every file in a project is tracked and stored as part of a revision. Revisions between users can be merged and tracked, and wayward revisions can be rolled back. We use a combination of on-server development, and Git as part of our internal Drupal workflow. This allows us as a small team to work together on a single server, while ensuring that every change is backed up and logged for future use. When working as part of a larger team, it's often more helpful to have each member working on their own branch from a localhost installation, and merging changes upstream to a central server. There are a number of different platform specific Git clients available, but I generally use the Sublime Text Git plugin, or Git via Cygwin.

FTP client

For projects that don't have Git on-server, you'll need an FTP client to upload files. I use the Sublime Text SFTP plugin, in combination with FileZilla for larger operations.

LAMP stack

If you're working with Drupal, chances are you've encountered the need for local development. Since Drupal is PHP & MySQL based, it requires a web and database server in order to run. There are a number of different server options for every platform. I've had great success with XAMPP on Windows, though lately I've been using the Acquia Dev Desktop for it's ease of use and rational default settings. If you happen to be using Acquia cloud for hosting as well, it offers easy integration.

Graphics editor

If you're a back-end only developer this may not apply to you, but if you do any front-end theming work you will need a solid graphics editor. The industry standard is Adobe Photoshop, and there is very little deviation within the designer/developer community. Personally I would be thrilled if everyone moved to an open source alternative such as GIMP, but as it stands you will not make it far in front-end web development without a solid understanding of Photoshop. This is actually the sole reason I don't work entirely in Ubuntu. While there are hodge-podge methods for running Photoshop on Linux, in my experience none of them work well. Photoshop is only reliably available on Mac & Windows.

Summary

In spite of the shortcomings, Windows offers a great development experience given the right setup. If you don't want to be locked into the Apple ecosystem, and software dependencies (or a serious gaming addiction) prevent you from using Linux, using the tools above will have you coding and committing with the best of them.