Take the 2-minute tour ×
Drupal Answers is a question and answer site for Drupal developers and administrators. It's 100% free, no registration required.

A few years ago I was in to Drupal 7 development. Back then, in the company I worked for, we just kept everything in the database, had a few modules we kept on disk somewhere, didn't really use version control, patches all over the place, ..., it was horrible.

Apart from that, I was trained as an OO developer and I was never really a big fan of how Drupal 7 development was done (everything global, using arrays where you should be using objects, ...). It just felt weird to me. Drupal 8 changes that.

Today, I'm working in a more professional environment (in Java amongst other things) and I would like to give Drupal another go. But I'll be using Drupal 8 this time.

My question is this: How do you set up a professional Drupal 8 (!) development environment?

I understand that you should use version control, probably git in this case, but what do I put on git? And where in the Drupal directory structure do I put all of my custom modules, themes, etc... ?

Do I create an installation profile, put my modules there and just host the entire profile on git?

I know that Drupal 8 is only in alpha and thus it is possible that there will be changes, but even for Drupal 7 getting an definitive answer to this seems next to impossible.

What I'd like to know is: How do the seasoned OO PHP people go about setting up a professional development environment and how can we apply this to Drupal 8?

With Drupal 8 saving a lot more configuration on the file system, how do I properly store that? I would be nice to have version control on that too. Is this possible or even recommended to do so?

How do you go about debugging the site/framework? Please don't tell me you just spam print_r statements everywhere.

Please note that I'm not talking about the Symphony or Drupal coding standards, they can be found quite easily.

If it is any help: I plan on using IntelliJ IDEA and its incredible set of plugins to do my development. I'm also on a windows computer, but I'm using a VM with linux to host my site(s).

I apologise for the long introduction and post. My only goal is to give you a little background information so that you know where I'm coming from and where I'd like to go.

Thanks for reading.

share|improve this question

1 Answer 1

up vote 5 down vote accepted

How do you set up a professional Drupal 8 (!) development environment?

Depends very much on your taste, experience and requirements, but essentially you need:

  • A web server
  • An up-to-date version of PHP
  • An IDE that supports step debugging (you'll be fine with IDEA as long as you have PHP's XDebug extension installed).
  • A version control system of your choice (the standard for Drupal is git, but it's not mandatory).
  • Drush

what do I put on git?

Whatever you want/need to, it may well vary from project to project. Most people I know keep all of their custom code in git. Some keep the entirety of Drupal in git along with their custom code, others don't. This is entirely personal preference, as neither way is "better" than the other, objectively speaking.

And where in the Drupal directory structure do I put all of my custom modules, themes, etc... ?

For Drupal 8 custom modules go in /modules, themes go in /themes, and profiles go in /profiles. Nice and easy to remember :)

Do I create an installation profile, put my modules there and just host the entire profile on git?

Installation profiles are designed to set up a Drupal install with a bunch of modules and config already taken care of. If you have a common set up for Drupal that you use for practically every site you build, then yes an installation profile would be useful. If you don't, then it probably wouldn't. I'm assuming you'd be keeping all of your custom code in git, so yes, if you go down this route, it should be stored in git.

With Drupal 8 saving a lot more configuration on the file system, how do I properly store that?

You don't need to, Drupal/your file system will store that for you.

I would be nice to have version control on that too. Is this possible or even recommended to do so?

Most certainly "yes" to both. The point of the config management system (as I understand it) is so that config changes can be pushed from server to server via code. Being able to version those changes is a big part of the point of the new system. See this blog post: Drupal 8 Configuration Workflows Using Git (and the associated linked video) for a lot more info on that.

How do you go about debugging the site/framework?

XDebug, or other debugger of your choice. There's no substitute for being able to properly step through your code and inspect contextual variables, in my opinion (and I'm sure many others').

The short answer to all your questions is really "your mileage may vary". It depends on what you know, what you're comfortable with, and what the rest of your team knows and are comfortable with. You could answer almost all of your specific questions with "it depends"...because it really does depend on a lot of unknown factors.

As an aside, it sounds like at least some of your "problems" with Drupal 7 were caused by bad development practices in your old company. For example, no-one in their right mind would use print_r to debug Drupal; even with the lack of a proper debugger one would always use the Devel module.

share|improve this answer
1  
This is pretty much spot on answer for a broad question like this! Well written. –  AjitS Aug 14 at 8:53
    
Thanks @Ajit, I could've gone on for days about this, had to reel it in a bit ;) –  Clive Aug 14 at 8:58
    
Thanks for your answer Clive! I really didn't mean for it to be a broad question, but I'll be able to fill in the blanks ;-) Even the dev module doesn't seem a lot better than print_r imho, but maybe I've never learned to use it properly... I'll look into that. Since you say you could go on for days, do you know of a place where I could find more articles that cover this topic? Thanks again. –  Mike Aug 16 at 18:06

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.