Note: New developer documentation pages should be added to the Development namespace by typing
Development:before the new page name i.e.
[[New page name]]
If you are a developer, you probably want to change your preferences to include the Development namespace in searches.
A page may be added to the Developer category by typing
at the bottom of the page.
[[Category:New page name]]
- 1 How Moodle development works
- 2 Guidelines
- 3 Documentation for core components
- 4 How you can contribute
- 5 Plans for the future
- 6 Resources
- 7 Tools
- 8 See also
How Moodle development works
You can also enrol in one of the Moodle Developer Courses.
The following guidelines are crucial reading for anyone wanting to contribute to the Moodle code base:
- Coding guidelines have to be followed by all Moodle developers
- Moodle design goals spells out the basic design goals behind Moodle
- Interface guidelines aim to provide a common feel to the Moodle user interface
- Moodle CVS for developers explains how to work with the Moodle code in CVS
- Tracker explains the Moodle Tracker for keeping track of bugs, issues, feature requests etc
- Working with the Community explains how to engage with the dev community and discuss changes
- Unit tests explains how to run the unit tests, and how to write new test cases.
- Fast portable SQL shows SQL techniques that are fast, efficient, and known to work on all supported DBs.
Documentation for core components
This section is for documentation of specific components of the existing core Moodle code. Discussion of components that are under discussion or in development can be found in the developer notes or on the roadmap.
The documents below give a general overview. For detailed function-by-function documentation, see the phpDocumentor documentation that is automatically generated from the comments in the code. And don't forget that the most up-to-date and detailed description of how the code works is the code itself, and you can browse the code online using phpXRef. Moodle code should be easy to read and understand. Use the source, Luke!
Core components that affect everything
- The database schema
- lib/weblib.php for outputting stuff
- Database abstraction layer @ v1.7
- Roles and Capabilities system @ v1.7 for controlling who can do what
- Forms library @ v1.8 for creating accessible and secure HTML forms that let users edit things
- File API @ v2.0 for managing files stored by Moodle
Core libraries with a more specific uses
- Authentication API
- Cookieless Sessions
- Email processing
- Environment checking before install, check the user's server to ensure Moodle will work there.
- Groups system
- Moodle Network
- Question engine
- Stats package
- Migration to UTF-8 @ v1.6
- Admin settings
Modules included in the standard distribution
How you can contribute
Make a new plugin
The M in Moodle stands for modular, and the easiest, most maintainable way to add new functionality to Moodle is by using one of the many plugin APIs. There are many types of plugin you can write:
- Activity modules, see also NEWMODULE Documentation (work in progress)
- Admin reports
- Assignment types
- Authentication plugins
- Course formats
- Course reports
- Database fields
- Database presets
- Enrolment plugins
- Gradebook plugins
- Portfolio Plugins
- Question types
- Question import/export formats
- Quiz reports
- Repository plugins
- Resource types
- Search engine adapters
General information that applies to all types of plugins
Please see the Guidelines for contributed code for an overview of how to contribute to the Moodle code.
Sometimes it is not possible to write a proper plugin for what you want to do, in which case you may have to resort to using the local customisations hook.
Change core code
Some types of change can only be made by editing the core Moodle code. Such changes are much harder to maintain than plugins. If you want your core change to be considered for inclusion in the official Moodle release, you need to create an issue in the tracker, and attach your change as a patch. It is also a good idea to discuss your ideas in the forums first. See Overview#Major_Development for more details.
Ways to contribute that do not involve PHP programming
- Create Moodle themes
- Translate Moodle into other languages
- Help document Moodle
- Join the testing effort, which involves participating in the bug tracker
Plans for the future
Ideas for and details of planned future features of Moodle are initially discussed on the forums in the Using Moodle course at moodle.org. That developer discussions are intermixed with user discussions in the same forums may seem strange at first but is one of the reasons for the success of Moodle. It is important that both end-users and developers discuss the future features together.
Once ideas begin to crystallize on the forums they can be summarized in this wiki, either as part of the roadmap or in the form of developer notes. These pages then form the basis for further discussion in the forums.
- Developer FAQ - frequently asked questions, especially useful for newcomers to Moodle
- Finding your way into the Moodle code - also aimed at newcomers
- Moodle tracker - bug reports, feature requests and other tracked issues
- Unmerged files - changes on the stable branch in CVS that have not been merged to HEAD
- Browse the code online:
- Moodle PHP doc reference - compiled from the comment attached to each class and function in the code
- Database Schema - for recent releases
- Development news and discussion section of Using Moodle course
Some tools people use when working on Moodle code:
- Setting up Eclipse for Moodle development - Eclipse is a great editor to use for php development, if you can work out how to set it up.
- Setting up Vim for Moodle development
- Setting up Netbeans for Moodle development - Netbeans Early Acces for PHP is a great out-of-the-box editor.
- Ctags - Using a tags file to navigate code
- W3C HTML validator - Moodle has built in support to make using it easier.
- Firebug add-on for Firefox.
- Windows Installer - Windows Installer documentation for developer.