Getting started in Moodle Development? Here is a list of useful tools for Windows that may be of interest to Moodle Developers.
Moodle Coding Style Guidelines
In general, you can configure code editors to understand 90% of the Moodle Coding Style by configuring it to use PSR-12 and PSR-1, in that order. On top of that, Moodle has its own customizations to those standards which you can learn more about here:
To support you in your development, you will want to ensure that the following plugins are installed on your development instance of Moodle:
- Code checker -- This tool enables you to check your code against Moodle's Coding Style Guideline. You should install the version from GitHub, not from Moodle.org as this last one can sometimes fall behind. The GitHub page includes instructions on how to integrate with eclipse, phpstorm and sublimetext.
- Marina Glancy's Moodle PHPdoc checker -- Checks PHPDoc blocks in your Moodle source code.
Toolbox for Moodle Developers
Here is a list of useful software for Moodle development in Windows. When given a choice, always choose the 64-bit version. Don't let the "free" price tag fool you -- these are all excellent tools. If you really find one or more of them useful, consider contributing to the project. Some of the ways you can contribute can include:
- Purchase the full/pro version if one is available -- especially if you are earning a living using the tool.
- Make a donation to the author if they don't have a premium version.
- Contribute bug reports, bug fixes, suggestions for enhancements.
- Spread the word and tell your friends about the cool/useful tool you found.
- At the very least, drop the authors of the tools a note to thank them for their development efforts and contributing their time and effort to making it available to the world. Developers like to know that people like you are enjoying the results of their work.
Remember, just because it is free doesn't mean it isn't worth anything.
Greenshot -- A light-weight free screenshot capture and annotation tool which is very useful for creating documentation and reporting issues.
ScreenToGIF -- A super simple tool to capture and edit videos. Very useful for demonstrating and reporting issues.
Colour Contrast Analyzer -- This is an accessibility testing tool to help determine the legibility of text and the contrast of visual elements, such as graphical controls and visual indicators. Also doubles as a great colour picker.
WinMerge -- This is a great tool for comparing files and whole folders for differences. Does 3-way comparisons.
Visual Studio Code -- VSCode is now one of the most popular code editors in the world. Once configured with extensions like PHPCS and others, this cross-platform text editor is often considered to be like an IDE by many developers for developing in Moodle. It is also considerably less expensive (free actually) and faster than Java based IDE's like PhpStorm and Eclipse. Note: Many developers use more than one code editing tool as each tool has its own strength. You don't need to pick just use one!
During the installation, ne sure to have the installer add VSCode to your search path. It will simplify a lot of the settings.
To make VSCode even better, the following are useful extensions you should consider installing for Moodle development:
- Git Graph -- View a Git Graph of your repository and perform Git actions from the graph.
- GitLens -Visualize code authorship at a glance via Git blame annotations and code lens, seamlessly navigate and explore Git repositories, gain valuable insights via powerful comparison commands, and much more.
- Moodle Snippets -- Make your life easier as a Moodle developer, using the main Moodle functionalities snipperts for VSCode.
- Moodle -- Snippets & Autocomplete -- Adds Moodle snippets and autocomplete of functions, classes, etc.
- Bracket Pair Colorizer 2 -- A customizable extension for colorizing matching brackets.
- Code Spell Checker -- Spell checking for source code.
- Duplicate section or line -- Adds the ability to duplicate text.
- Mustache -- Syntax highlighting for mustache.
- PHP CS Fixer Extension for VS Code -- PHP formatter, PHP code beautify tool, format HTML.
- PHP Debug -- A debug adapter between VS Code and XDebug.
- PHP DocBlocker -- A tool to help with the creation of PHPDoc blocks.
- PHP Intelliphence -- Enhances PHP code intelligence for Visual Studio Code.
- PHP Intellisense -- Advanced Autocompletion and Refactoring support for PHP
- PHP Snippets from PHPStorm -- This extension aims to provide the PHP Live Templates that come by default in new PHPStorm installations for Visual Studio Code.
- Rewrap -- Re-wraps comments and other text to give line length.
- TODO Highlight -- Hilights TODOs, FIXMEs in your source code.
Composer -- Composer is a dependency manager for PHP which is used to install components used for Moodle development.
PHP CodeSniffer -- Great tool for linting PHP code. The easiest way to install PHP CS is to first install Composer and then use the following CLI command: composer global require squizlabs/php_codesniffer
Git for Windows -- Git is used to manage source code version control in Moodle. During the installation, be sure to enable Git Bash and have the installer add git to your search path. It will simplify a lot of the settings.
Here are some settings for Git:
Set your full name and email address
This will be used when you create commits:
git config –global user.name "Your first and last name" git config –global user.email email@example.com
Colourize GIT (Optional)
git config --global color.ui auto git config --global color.interactive auto
Configure GIT for use with VSCode
git config --global core.editor "code --wait"
If you want to use VSCode as your Merge Tool, use the following and skip the instructions Configuring GIT for use with WinMerge below:
git config --global merge.tool vscode git config --replace --global mergetool.vscode.cmd code --wait $MERGED git config --global diff.tool vscode git config --replace --global difftool.vscode.cmd code --wait --diff $LOCAL $REMOTE
Configure GIT for use with WinMerge
If you are using VSCode as your git merge tool, skip this section.
Note: You may need to modify some of the paths depending on where you installed WinMerge.
git config --global merge.tool winmerge git config --replace --global mergetool.winmerge.cmd "\"C:\Program Files\WinMerge\WinMergeU.exe\" -e -u -dl \"Base\" -dr \"Mine\" \"$LOCAL\" \"$REMOTE\" \"$MERGED\"" git config --global diff.tool winmerge git config --replace --global difftool.winmerge.cmd "\"C:\Program Files\WinMerge\WinMergeU.exe\" -e -u -dl \"Base\" -dr \"Mine\" \"$LOCAL\" \"$REMOTE\"
Additional merge tool settings
git config --global mergetool.prompt false git config --global mergetool.keepBackup false git config --global mergetool.keepTemporaries false git config --global mergetool.trustexitcode=false
On Windows, you may also find the following settings useful since the Git repo is made for Linux:
core.autocrlf=false core.whitespace=cr-at-eol core.filemode=false gui.encoding=utf-8
This will change the default date format in the output of git log commands to ISO (YYYY-MM-DD) so that you can see the year of the commit:
git config --global log.date iso
Add a comment: