Skip to content
| Marketplace
Sign in
Visual Studio Code>Formatters>PHP Ruleset FormatterNew to Visual Studio Code? Get it now.
PHP Ruleset Formatter

PHP Ruleset Formatter

Warethis Development

|
6 installs
| (0) | Free
Formats PHP using a lightweight ruleset interpreted from an XML file.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

PHP Ruleset Formatter

A small VS Code extension that formats PHP using a lightweight interpreter for a PHPCS-style XML ruleset.

Features

  • Formats full document and selected ranges for PHP files.
  • Adds Format PHP (Ruleset) in the editor context menu.
  • Adds PHP Ruleset Formatter: Open Ruleset File command to quickly edit rules.
  • Reads rules from .vscode/php-ruleset-formatter.xml by default.
  • Supports settings overrides.

Settings

  • phpRulesetFormatter.rulesetPath: XML ruleset path.
  • phpRulesetFormatter.overrideRules: object for overriding parsed rules.

Edit rules quickly

Run PHP Ruleset Formatter: Open Ruleset File from the Command Palette.

  • If the configured ruleset file exists, it opens directly.
  • If it does not exist, the extension creates it with the base template and opens it.

Supported rules (current)

  • tab-width argument.
  • Generic.WhiteSpace.DisallowSpaceIndent -> tab indentation.
  • Generic.Functions.OpeningFunctionBraceKernighanRitchie.BraceOnNewLine -> opening brace on same line.
  • Squiz.ControlStructures.ControlSignature.SpaceAfterCloseBrace excluded -> no else cuddling.
  • Squiz.WhiteSpace.FunctionSpacing property spacing.
  • Custom.Header.NoBlankLines -> removes blank lines between <?php, namespace, use, and declare(...) header lines.
  • Exclusions for trailing whitespace and Windows EOL behavior.

This extension does not run PHPCS. It applies simple formatting transformations based on interpreted rules.

Package and install

  1. Build a VSIX:

    npm run package:vsix

  2. In VS Code, run Extensions: Install from VSIX... and choose the generated .vsix file.

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2026 Microsoft