The many usability improvements of Moodle 3.2 extend, beyond students and teachers, to developers, who want to create new plugins for the community on Moodle’s most stable version to date.
Following the walkthrough from the Moodle Docs, there are three steps to contribute a plugin to Moodle. We will update the documents in the light of the new Moodle 3.2.
As it is often the case, it is recommended to think through your plugin functionality and architecture before writing the first line of code, as well as checking out the Moodle Plugin Directory to make sure your idea has not been developed by another Moodler.
The Moodle Development Environment
Moodle 3.2 is based on Bootstrap 4, which officially is still an “alpha” release. This means that stability is still subject to improve over time, and when it does, your Moodle development will enjoy the improvements without doing extra work.
Something similar happens with PHP. Moodle 3.2 has updated the minimum version to PHP 5.6.5. Plugins written with earlier versions are not likely to work. Recently released PHP 7.1 is fully compatible with Moodle 3.2 but HQ developers warn this version is much stricter and will throw errors more often. PHP 7.0.+ versions in testing have shown limitations and conflicts, especially in databases.
Regarding databases, Moodle 3.2 will work with the latest versions. Minimal supported versions are listed below:
- PostgreSQL 9.1
- MySQL 5.5.31
- MariaDB 5.5.31
- Microsoft SQL Server 2008 (See Warning)
- Oracle Database 10.2
Warning: PHP 5.3 discontinued support for SQL Server. Developers interested in using it with Moodle 3.2 should research about Microsoft SQL Server Driver for PHP. Microsoft has made some build available via GitHub for Windows and Linux, which have many issues unresolved. Compatibility with Azure SQL Database is still an unresolved issue in the Moodle Tracker.
Moodle 3.2 supports most standards compliant web browser. It is recommended to use the latest version. Moodle is frequently tested with:
- Mozilla Firefox
- Chrome and Chrome Mobile
- Safari and Mobile Safari
There are known compatibility issues with Moodle 3.2 with Internet Explorer 10 and below and Safari 7 and below.
Plugin submission to Moodle requires the plugin to use an open repository. GitHub is by far the repository of choice.
To begin development, create a repository, set up git on your work station, and plan to schedule commits.
Anatomy of a Plugin
The structure of a plugin remains unchanged for Moodle 3.2, and it follows the same file structure:
plugin_name(the main folder, also the name of your plugin.)
classes(folder with the actual plugin code)
db( folder with the database files, and database capabilities that are laid out in the
lang(folder with language files.)
lib.php(file that lists external libraries used by your plugin and the connection methods.)
version.php(file that lists some basic plugin information. The Moodle Directory uses this information for search and filtering.)
All plugins use this structure, but plugins themselves are divided by types. Moodle 3.2 will still support all plugin types, but HQ is discouraging Blocks as they are not supported in Moodle Mobile.
New developer tools
Developers have access to many new technologies to develop plugins that do not require external libraries. Those are:
- Bootstrap 4
- JQuery 3.1
- AMD Modal
- Linting for JS with ESLint and for CSS with stylelint
- Composer.json for Moodle code download
- phpunit 5.x
- Behat now supports added features to themes (
- CLI now allows debugging
Other tools at their disposal are:
- Plugin authentication methods
- Filesize is a new file information field
Utilities deprecated of changed are:
- Boxnet v1 API is deprecated
- Grunt and npm now require node.js 4 or above.
Do you have all it takes to begin your plugin development? Is there something you are missing? Write to us in the comments!