Moodle Development Plugin for IntelliJ IDEA
This plugin helps Moodle Developers work efficiently by providing development tools and ensuring compliance with Moodle coding standards and requirements.
Before installing the plugin, ensure you have:
- PHP 7.4 or later installed and available in PATH
- Composer installed globally and available in PATH
- Git (optional, but recommended for version control)
Installation
Using IDE built-in plugin system:
- Open IntelliJ IDEA
- Go to Settings/Preferences > Plugins > Marketplace
- Search for "moodle-dev"
- Click Install Plugin
- Restart IDE when prompted
Manual Installation:
- Download the latest release
- Open IntelliJ IDEA
- Go to Preferences > Plugins > ⚙️ > Install plugin from disk...
- Select the downloaded plugin file
- Restart IDE when prompted
Configuration
Option 1: Auto Settings (Recommended)
- Open your Moodle project in IntelliJ IDEA
- Right-click on the project in the Project Explorer
- Select "Moodle" > "Auto Settings"
- The plugin will automatically:
- Enable all required features
- Configure your developer information
- Set up PHP_CodeSniffer with Moodle standards
- Set Composer's minimum-stability to dev
- Install moodlehq/moodle-cs globally
- Configure all necessary paths
Option 2: Manual Configuration
If you need to adjust settings manually:
-
For PHP_CodeSniffer settings:
- Go to Settings/Preferences > PHP > Quality Tools > PHP_CodeSniffer
- Configure paths to phpcs and phpcbf executables
- Set up coding standards
-
For other Moodle-specific settings:
- Go to Settings/Preferences > PHP > Frameworks
- Find the "Moodle" section
- Adjust settings as needed
Features
- Moodle-specific code templates and generators
- Automatic code style configuration for:
- PHP
- JavaScript
- LESS
- SCSS
- Integration with Moodle Code Sniffer
- Support for Moodle project structure:
- PHP classes in 'classes/' directory
- Mustache templates in 'templates/'
- Database files in 'db/'
- Language files in 'lang/'
- JavaScript files in 'amd/src/'
- CLI scripts in 'cli/'
- Backup files in 'backup/'
- Images in 'pix/'
Troubleshooting
Common Issues
-
Plugin not detecting Moodle directory
- Ensure the directory contains a valid Moodle installation
- Check if version.php exists in the root directory
- Verify directory permissions
-
PHP_Codesniffer not working
- Verify Composer is installed and in PATH
- Check Composer global installation directory permissions
- Try running
composer global require moodlehq/moodle-csmanually - For Windows users, the plugin now automatically detects .bat extensions for executables
-
Code style not applying
- Ensure the plugin is enabled
- Verify the Moodle project directory is correctly set
- Try restarting the IDE
-
Composer operations failing
- The plugin now includes improved error handling and fallback mechanisms
- Default Composer directories are checked if the command-line detection fails
- More detailed logs are available for troubleshooting
Getting Help
- Check the plugin issues page
- Submit a new issue if you encounter problems
- Include relevant logs and configuration details when reporting issues
Plugin based on the IntelliJ Platform Plugin Template.