chrisjenkinson/symfony-service-sorter

Sorts entries in the services: key of Symfony YAML files alphabetically

Maintainers

Package info

github.com/chrisjenkinson/symfony-service-sorter

pkg:composer/chrisjenkinson/symfony-service-sorter

Statistics

Installs: 2

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v1.0.0 2026-04-21 07:52 UTC

This package is auto-updated.

Last update: 2026-04-21 09:58:11 UTC


README

CLI for checking and fixing service ordering in Symfony services: YAML files.

What it does

symfony-service-sorter helps keep Symfony service definitions in a consistent order. It provides:

  • check to report out-of-order services
  • fix to rewrite a file into the expected order

Installation

Install it as a development dependency:

composer require --dev chrisjenkinson/symfony-service-sorter

The binary is available at vendor/bin/sort-services.

Usage

Run the binary with a subcommand and a target YAML file:

vendor/bin/sort-services <command> <path-to-yaml-file>

Check

vendor/bin/sort-services check config/services.yaml

check exits successfully when services are already in order and reports ordering problems otherwise.

Fix

vendor/bin/sort-services fix config/services.yaml

fix rewrites the file in place. To print the sorted output instead, use:

vendor/bin/sort-services fix config/services.yaml --stdout

Compatibility

  • PHP ^8.2
  • Symfony Console ^6.0 || ^7.0 || ^8.0

Development

Useful local verification commands:

vendor/bin/phpunit
vendor/bin/ecs check
vendor/bin/phpstan analyse
vendor/bin/infection --threads=max --min-msi=85 --min-covered-msi=85

License

GPL-3.0-or-later