Skip to content

Formatter

Formatter

Shopware CLI includes a built-in code formatter for PHP, JavaScript, CSS, SCSS, and Admin Twig files. Use it to apply the Shopware Coding Standard automatically and keep your project consistent. You can format individual extensions or entire projects.

A --dry-run mode is also available to preview changes without modifying files.

The formatter runs PHP and Node.js tooling under the hood. The Docker examples are recommended because the image already contains the required runtime dependencies. If PHP and Node.js are available locally, you can run the shopware-cli commands directly instead.

Formatting an extension

Formatting an entire project

Configuration

By default, the formatting is done by Shopware Coding Standard. You can configure the formatting by creating a .php-cs-fixer.dist.php in your extension root or a .prettierrc file for JavaScript, CSS, and SCSS files.

Was this page helpful?
UnsatisfiedSatisfied
Be the first to vote!
0.0 / 5  (0 votes)