A simple solution is to use symplify/config-transformer.
First, install:
composer req symplify/config-transformer
And then simply:
vendor/bin/config-transformer switch-format app/config/whatever.yaml -i yaml -o xml
You can do it for the whole directory and also to switch to PHP based configuration:
vendor/bin/config-transformer switch-format app/config -i xml -o php
After doing it, you'll probably have to edit your App\Kernel
since by default it mostly loads YML files only (and some PHP config files).
If one starts with the default 5.3 Kernel, and had converted all configuration to XML, you'd need to change the file so:
namespace App;
use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
use Symfony\Component\HttpKernel\Kernel as BaseKernel;
use Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator;
class Kernel extends BaseKernel
{
use MicroKernelTrait;
protected function configureContainer(ContainerConfigurator $container): void
{
$container->import('../config/{packages}/*.xml');
$container->import('../config/{packages}/'.$this->environment.'/*.xml');
$container->import('../config/services.xml');
$container->import('../config/{services}_'.$this->environment.'.xml');
}
protected function configureRoutes(RoutingConfigurator $routes): void
{
$routes->import('../config/{routes}/'.$this->environment.'/*.xml');
$routes->import('../config/{routes}/*.xml');
$routes->import('../config/routes.xml');
}
}