php-coding-style

Enforce Moodle PHP coding style with PSR-12 and PSR-1 rules.

Updated Mar 6, 2026
One-click install
npx skills add https://github.com/renne/skills --skill php-coding-style
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: php-coding-style
Source: https://github.com/renne/skills/tree/main/moodle/php-coding-style
Command: npx skills add https://github.com/renne/skills --skill php-coding-style

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill ensures PHP code adheres to Moodle's specific coding style guidelines, improving code consistency, readability, and maintainability across the Moodle ecosystem.

Core Features & Use Cases

  • Style Enforcement: Guides developers on indentation, naming conventions, brace placement, line length, and commenting.
  • Consistency: Promotes a uniform codebase, making it easier for teams to collaborate and for new developers to onboard.
  • Use Case: When developing a new Moodle plugin, use this Skill to ensure your PHP code follows the established Moodle standards before submission.

Quick Start

Review the provided PHP code snippet against the Moodle coding style guidelines.

Frequently Asked Questions about php-coding-style

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I check if my PHP code follows Moodle coding standards?

You can check PHP code against Moodle coding standards by applying rules based on PSR-12 and PSR-1 with Moodle-specific modifications. It validates indentation, naming conventions, brace placement, PHPDoc comments, and SQL formatting.

What is the difference between PSR-12 and Moodle PHP coding style?

Moodle PHP coding style is based on PSR-12 and PSR-1 but adds Moodle-specific rules. It enforces additional guidelines for indentation, naming conventions, brace placement, PHPDoc comments, and SQL formatting tailored for Moodle core and plugins.

How do I validate PHPDoc comments in a Moodle plugin?

To validate PHPDoc comments in a Moodle plugin, use the Moodle PHPdoc Checker. It ensures your inline documentation adheres to the established Moodle coding style guidelines for consistency and maintainability.

Does Moodle Code Checker support automated PHP style enforcement?

Yes, Moodle Code Checker supports automated PHP style enforcement using PHP_CodeSniffer. It automatically validates PHP code against Moodle's specific coding style rules derived from PSR-12 and PSR-1 standards.

When do I need to apply Moodle-specific rules to my PHP code?

You need to apply Moodle-specific rules to PHP code when writing or reviewing code for Moodle core or plugins. Applying these coding standards ensures your code passes validation before plugin submission.