Skip to main content

Getting started

Ready to code?

A quick start to Moodle development

  1. Create an account on Moodle.org. You will need this to access the Moodle General Developer forum and download Moodle plugins. You can also sign up to free self-paced courses in our Moodle Academy Developer Learning Pathway

  2. Create an account on GitHub and install Git on your computer. This is the source code version control repository tool of choice for Moodle development.

  3. Install Moodle on your machine or use a container environment like moodle-docker. You can also use Moodle Development Kit (MDK).

    tip

    We highly recommend that you use a database administration tool such as adminer to help you manage your development databases.

  4. Set-up Moodle for development:

  • Enable the Moodle Debugger.

    tip

    When developing in Moodle, it's recommended to turn debugging on. Only turn it off for demonstration purposes as it does have a considerable impact on the performance of your Moodle website.

    Attention

    Always resolve all errors and warnings that show up with Moodle debugging turned on. Errors and warnings imply that something isn't working as it is supposed to which means your code isn't doing what you intended it to, or may be fragile and could break in the future.

  • Install the Moodle PHP CodeSniffer. This will be used to test your plugin for conformance with Moodle coding standards. Use this to develop good coding skills.

  • Install the Moodle PHPdoc check plugin. This will be used to test your source code documentation. This will also help improve your coding skills.

    Advanced

    You can use Xdebug to enable step-by-step debugging in PHP. Integrations are built into many popular editors. Learn more

And finally remember these wise words from Michael Milette in the General developer forum:

Learning how to code in Moodle involves a lot of learning by example and reading other people's source code including Moodle core code. If you have a particular type of plugin in mind that you would like to create, it's recommended that you start by finding a plugin which provides similar functionality and use the process outlined above to clone it. Then customize it to suit your needs. You can even do this with 3rd party plugins found on the plugins directory. That's just one of the many advantages of developing with open source. Just always remember to give credit to the original author for his/her original hard work. [...]

Learning all of Moodle and its database takes time - maybe even years. In fact you may never come across parts of it and that's OK. Take it one step at a time and don't be afraid to ask for help when you get stuck. The only expectation by the worldwide community is that you will have tried to figure things out on your own before asking a question. Google is your friend. Just start your query with the word "moodle".

Communication

If you have any question or want to share your ideas, there are several channels you can use to communicate with other developers:

Developer FAQ

Visit our Developer FAQ page and get answers to some of our most common questions.

See also