Follow the Examples project on Twitter:

Code Examples For Drupal

The Examples for Developers project aims to provide high-quality, well-documented API examples for a broad range of Drupal core functionality.

The Examples project contains many modules which hopefully illustrate best practices for implementing various Drupal APIs. These modules can be enabled individually, and will typically add menu items to your site, which should guide you through their features. You can then look through the code to see what they are doing.

Developers can learn how to use a particular API quickly by experimenting with the examples, and adapt them for their own use.

Note also that these modules demonstrate internals for Drupal development in PHP (and some JavaScript). Not all Drupal users will need these examples. There are many contributed modules which will do the majority of what a Drupal site-builder could need. Be sure and explore other contributed modules to see if you can find one that meets your needs.

How To Use These Modules

As Modules

You can enable these modules just like any others. They all add menu items leading you to a page on your site that will tell you what they are doing.


You can also browse the documentation generated from this project on This gives you the benefit of clickable links between the various functions and classes.

Browse The Repo

You can browse the code itself on the official Drupal cgit site, here:

Adapt The Code

All of the code in this project is presented under the GNU license, which is the case for all code on You can use and modify this code in your own project under that license.

Core Only

This project covers only core Drupal APIs. Many other APIs exist, and have their own example code. You can find them by following this link: Non-core Drupal examples.

End Of Life

We are discussing the EOL for Drupal 6, and eventually Drupal 7 here:

How can you help?

I'm glad you asked:

  • Most of all, we need you to file an issue every time you find an error or ambiguity or something that could be presented better.
  • We need additional examples.
  • We need reviews, corrections, and improvements to existing modules.
  • We need improvements in the doxygen comments.
  • We need help figuring out how to organize this growing mass of examples better, and how to improve the doxygen output on

Please feel free to help out in the issue queue. Jump right in.

You can familiarize yourself with The Tao of Examples Development on these issues:

What examples do you need as a developer? Create an issue in the queue if you think there's a need.

Where are the Drupal 8 examples?

We need Drupal 8 examples! :-)

There is a meta issue about converting all the examples... Feel free to take one on: #1880976: [meta] Port examples to D8

Also there is a proposal to move Examples into Drupal core for Drupal 8. #1532612: Move Examples Project into Drupal core


Here some links to run the modules in the project at by branch:

examples_meatwad256.png23.18 KB

Project Information