This guide focuses on developing in Drupal 7. If you're working in another version of Drupal, please visit our tutorial library page and apply the relevant filters for "Module Development" and your version of Drupal.
Want to jump ahead? Here’s a list of the sections in this document:
- About developers
- Meet some developers
- Learn to be a developer
- Background and prerequisites
- Core lessons
- Advanced concepts
- Broaden your skills
When creating solutions to meet their specific use case, developers do so with an eye towards creating reusable tools when possible, and/or collaborating with other developers to enhance existing tools that are close to, but not quite, the solution needed.
Developers are generally expected to be proficient with Drupal site building, and to know how to leverage the ecosystem of existing contributed modules and Drupal core APIs in order to prevent duplication.
Meet some developers
Get to know some people who develop with Drupal, through these interviews:
Learn to be a developer
Learning to be a master of Drupal development can be a daunting task, especially when you’re just getting started. There’s a lot to learn, and a lot of the best information is spread out across Drupal.org and various other websites, books, and podcasts. As you’re climbing the ladder and becoming more proficient with Drupal, here are some things to keep in mind:
- Drupal is open-source software, and as such, the code is freely available to read. Looking at how Drupal core or other contributed modules have solved problems similar to yours is a great way to get started.
- The Drupal API is quite extensive; focus on mastering high-level concepts and terminology first. Don’t try and memorize all the details—instead, use the tools available to look up the documentation and examples for implementation-specific details.
- Knowing when to write custom code vs. using an existing solution is an important skill
Background and prerequisites
Before you get into learning the Drupal specific parts of development, you’ll want to make sure you’re up-to-speed with PHP the programming language in which Drupal software is written. Drupal 7 is written primarily using procedural programming, though you'll encounter a smattering of object-oriented elements as well. As you learn to develop modules for Drupal, you’ll use a combination of PHP fundamentals combined with Drupal-specific functions and APIs.
- PHP Fundamentals — Learn the PHP fundamentals you’ll need to be a Drupal developer
- Introduction to Object-Oriented PHP — Basic OOP knowledge is expected. This will be required knowledge for Drupal 8, so get started now.
Bonus: Developers are expected to know how to work on a copy of the live site, instead of making potentially hazardous changes or testing new ideas on the live site. Our guide to installing a local development server explains different ways that you can setup a local development environment.
Developers are expected to know how to create new Drupal modules—bundles of PHP code that extend, alter, or otherwise enhance Drupal’s functionality. This requires knowledge of Drupal’s system to allow your custom code to interact with existing functionality, known as hooks. You'll also need to get familiar with the suite of APIs that make up the Drupal framework, many of which exist to ensure you don’t have to re-write the same code over and over.
- Drupal 8 Module Development Guide OR Module Development for Drupal 7 — Start here to learn the baseline concepts and tools in module development. All of our other developer tutorials will assume you know the material in this series of lessons.
- Drupal 8 Entity API OR Drupal 7 Entity API — Store and retrieve your custom data in Drupal using the Entity API.
- Drupal 7 Field API — Create new field types, widgets, and formatters, or alter existing ones.
- Coding for Views — Expose custom data to views, create new ways to display fields, and add additional plugins.
Version control — git
Drupal developers use the Git version control software to collaborate on the code they write, contributed module development, and even Drupal core itself. Learning the basics will help you stay organized and provide you with some essential skills for anyone working with a team. Even if you're the sole person on the project, there are still myriad advantages to using a version control system as part of your daily workflow.
- A Vision for Version Control — What is version control, and why should you be using it for all of your projects?
- Introduction to Git — Everything you need to know to get started using Git.
- Apply and Create Patches — How to apply a patch to a module provided by another developer, and how to create your own so you can contribute your fixes back to the community.
Once you’ve mastered the basics of creating a new module, you'll want to learn about the advanced concepts necessary to become a truly top-notch Drupal developer. Module developers need to be able to write tests, understand deployment techniques, and work with tools like Drush. These skills and best practices will help you and your team be more efficient as you integrate them into your workflow.
- Introduction to Drush — Learn how to install and use Drush, the Drupal shell. And then learn how to write your own custom Drush commands.
- Installing Drush with Composer — Drush now works with Composer. Learn how to install Drush on your local machine using Composer. New to Composer? Learn all about The Wonderful World of Composer in this overview.
- Configuration Management and/or Deployment with Features and Drush — Learn how to make a change to the configuration of a view or content type in the UI and then programmatically deploy those changes by encapsulating configuration in code. An essential part of the industry standard best-practice for implementing a development > staging > live workflow into your projects.
- Automated Testing with SimpleTest — A framework for creating both functional and unit tests for your code, and the system used by Drupal core for automated testing.
Developers tend to be very particular about the way code is written. Should I indent with tabs or spaces? Do you use
$CamelCase or underscores for
$variable_names? Which is the appropriate way to load multiple nodes at the same time?
In general, it’s a good idea to agree upon and then adhere to a set of coding standards. Doing so ensures that you and your team can focus on discussing the things that matter instead of debating if that brace should go on a new line by itself, or not. The Drupal project already has a great set of coding standards, and requires that they are followed for any contributed code. So, if you’re working on code for Drupal, it’s worthwhile to learn what those standards are.
- The Drupal coding standards — The canonical reference for Drupal’s coding standards.
- Understanding the Drupal Coding Standards — Walks through the most commonly encountered parts of the PHP standards.
- PhpStorm IDE — This series from JetBrains, the developers of PhpStorm, provides an overview of the purpose and function of an IDE and walks through the features and functions of this widely-used tool.
- Tutorial Tools — Learn how to get a Drupalize.Me tutorial demo site up and running using either Acquia Dev Desktop 2 or Pantheon.
- Manage Drupal Sites with Pantheon — Pantheon provides a free development environment that you can use to host Drupal projects.
The Drupal 7 module developers guide is a community maintained wiki that contains a few walk-through style tutorials for creating a custom module as well as information about concepts like “hooks”, and “the code registry” that are important to understand. The Working with the Drupal API section of the community documentation has helpful information on Drupal’s core systems. Go here to find out conceptual information like how the pieces fit together, for example the workflow a form goes through during processing.
The official documentation for Drupal’s API is parsed from the PHP source code and can be viewed at https://api.drupal.org. Go here if you want to know how to use a particular API function, or get an example of implementing any core hook.
Contribute to the Drupal project
Although not a requirement, many Drupal developers also enjoy being active members of the Drupal community and contributing their solutions back to Drupal.org in the form of a contributed module, or by helping to resolve bugs in the modules they use, or even in Drupal core itself. Nothing will improve your understanding of Drupal like explaining it to someone else—or taking pieces of it apart and fixing them.
- Drupal Ladder — Climb the Drupal ladder and learn how to navigate and use the issue queue, create and apply patches, and other essential skills needed to contribute code to the Drupal community
- Community Tools — Learn about the tools the Drupal community uses to communicate and collaborate
- Dive Into Drupal 8 with the Help of Core Contribution Mentors — Some practical advice on getting started contributing to Drupal core and utilizing core office hours.
This is just a selection of what we have on this topic. To get a full list of all tutorials tagged “module development”, please use our library page. You may also want to explore tutorials tagged with "system administration" as often times these are skills that are expected of developers in addition to being able to write modules.
Prepare for Drupal 8
We’ve prepared a guide to Preparing to Drupal 8 which contains our latest resources on building technical skills that you will use in Drupal 8 development. The tutorials in this guide include:
- Introduction to Object-Oriented PHP Series — Learn to work with object-oriented concepts through building an app with OO-PHP
- Object-Oriented PHP, Part 2 — Continue learning object-oriented PHP with the project that we started in the Introduction to Object-Oriented PHP series.
- An Introduction to YAML — YAML files are in wide use in Drupal 8, and you will need to understand the basic format and syntax of this format.
- Twig Templating — In this series, we’ll show you how to use Twig from the ground up, clearly pointing out its syntax, and then graduating to some really neat and advanced tricks.
- Dependency Injection and the Art of Services Containers — Sharpen your object-oriented skills by exploring the ideas and reasons behind dependency injection.
- The Wonderful World of Composer — Learn about this dependency manager for PHP
- Semantic Versioning — Learn about this new specification for numbering software releases, as adopted by Drupal 8.
- PHP Namespaces in 120 Seconds — Still not quite comfortable with PHP 5.3 namespaces? No problem! Give us 120 seconds, and we’ll introduce you to all the crazy characters (“namespace”, “use” and “”) and show you how they work.
- Starting in Symfony2 — Introduce yourself to Symfony2 and get familiar with some of the same tools that have been integrated into Drupal 8.
What’s new in Drupal 8 for developers
Broaden your skills
In this section, build upon your foundation in development with these tutorials, presentations, podcasts, blog posts, and other online resources.
These tutorials build on a module development foundation, and show you how to leverage the latest tools and technologies in Drupal core and contributed modules.
- Integrate Node.js with Drupal — Learn how to integrate Node.js with Drupal 7 using the Node.js Integration contributed module on Drupal.org.
- Customize Panels Styles with CTools Style Plugins — Learn the anatomy of a CTools Style Plugin
- Automated Testing in Drupal 7 with SimpleTest — In this series, we’ll learn to write our own automated tests for Drupal 7 using SimpleTests.
- Drupal 7 Token API — After completing the lessons in this series, you should have all the tools and knowledge you need in order to use the Drupal 7 core token API, and the additional features provided by the contrib Token module.
This is just a selection of what we have on this topic. To get a full list of all tutorials tagged “module development”, please use our library page. You may also want to explore tutorials tagged with "system administration”, as often times these are skills that are expected of developers, in addition to being able to write modules.
The following Drupalize.Me podcasts may also be of interest to developers.
- The New Lullabot.com — React js, CouchDB, node, decoupling Drupal; if any of that sounds cool to you, then this is the podcast for you.
- Let’s Chat About Web Accessibility — What you can do to improve accessibility on the web.
- The Syfy Project — Learn how Lullabot helped transform the new Syfy.com.
- Drupal Console — A new and developing suite of command-line tools for Drupal 8.
- Drush and Composer — The winning Drupal Toolkit.
- The RESTful Module — RESTful module, decoupling, headless Drupal.
- Drupal as a Services Platform — Authors from Drupal Watchdog chat about web services and Drupal.
- Content Delivery Networks (CDNs) — What is a CDN and how do they work?
DrupalCon sessions are a great way to get up to speed on the latest in Drupal development. All DrupalCon sessions are recorded and are available for free on the Drupal Association’s YouTube channel. The videos are also embedded on the session description pages for each DrupalCon, so you can browse developer tracks on the DrupalCon website and find session recordings to watch after the Con.
- DrupalCon — Find links to past, present, and future DrupalCons and session recordings.
Drupal camps, sprints, user groups are great way to connect with other Drupal developers and learn new things.
- Drupical — Filter and find Drupal camps, sprints, user groups, and training events.
- Upcoming Drupal community events — Filter and find Drupal-related events.
- Tutorial: Vagrant Drupal 8 Development — In this tutorial, you’ll learn how to set up a local Drupal 8 development environment using the Vagrant Drupal Development (VDD) contributed module, Chef, Vagrant, and VirtualBox.
- Learning to Debug: Stop Thinking and Look — Debugging is a discipline that requires patience, and a fervent attention to detail. In the fast-paced world of software development, when we’re faced with deadlines and an ever-growing list of new features to add and bugs to resolve, it can be difficult to slow down and proceed in a meticulous, measured fashion. When it comes to solving difficult problems, this fastidious approach is exactly what’s required to locate and resolve a problem’s root cause.
- Learning to Debug: Stop Making Assumptions — Learn more about the soft skill of debugging in this article.
This is just a sampling of blog posts. Browse these topics to find more articles that may be of interest to you as a developer: