Last updated 19 May 2009. Created on 7 September 2006.
Edited by jhodgdon, domesticat, LinL, Xano. Log in to edit this page.

This tutorial describes how to create a module for Drupal 5. It is an update to the tutorial for Drupal 4.6. Please see comments there, also. Most of this tutorial is valid for Drupal 4.7 as well, but you should check the API documentation, as well as the documentation on how to update your modules from one version of Drupal to another. See the Contributor's Guide for the Drupal 6.x version of this tutorial.

A module is a collection of functions that link into Drupal, providing additional functionality to your Drupal installation. After reading this tutorial, you will be able to create a basic block module and use it as a template for more advanced modules and node modules.

This tutorial will not necessarily prepare you to write modules for release into the wild. It does not cover caching, nor does it elaborate on permissions or security issues. Use this tutorial as a starting point, and review other modules and the Drupal handbook and Coding standards for more information.

This tutorial assumes the following about you:

  • Basic PHP knowledge, including syntax and the concept of PHP objects
  • Basic understanding of database tables, fields, records and SQL statements
  • A working Drupal installation
  • Drupal administration access
  • Webserver access

This tutorial does not assume you have any knowledge about the inner workings of a Drupal module. This tutorial will not help you write modules for versions of Drupal earlier than 4.5.


This tutorial is also available in Polish.

Looking for support? Visit the forums, or join #drupal-support in IRC.