Follow the Examples project on Twitter: https://twitter.com/DrupalExamples
and you are welcome to join:

#examples_module in Drupal Slack

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

Do not enable this module in production environment!

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.

Which branch?

Current development goes in 4.0.x branch, that is aimed to work with core version 9.4+

Other supported branch is 3.x (core 8.7.7+)

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.

API.Drupal.Org

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

Browse The Repo

You can browse the code itself in gitlab, here: https://git.drupalcode.org/project/examples

Adapt The Code

All of the code in this project is presented under the GNU license, which is the case for all code on drupal.org. 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.

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 api.drupal.org.

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.

Demonstration

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

Project information

Releases