How to alter the parameters in the core.services.yml file programatically? I need to modify the filter_protocols parameter inside the core.services.yml file programmatically to add a new protocol. I know how to alter a service but I don't find any information about how to alter a parameter.
parameters:
  session.storage.options:
    gc_probability: 1
    gc_divisor: 100
    gc_maxlifetime: 200000
    cookie_lifetime: 2000000
  twig.config:
    debug: false
    auto_reload: null
    cache: true
  renderer.config:
    required_cache_contexts: ['languages:language_interface', 'theme', 'user.permissions']
    auto_placeholder_conditions:
      max-age: 0
      contexts: ['session', 'user']
      tags: []
  factory.keyvalue:
    default: keyvalue.database
  http.response.debug_cacheability_headers: false
  factory.keyvalue.expirable:
    default: keyvalue.expirable.database
  filter_protocols:
    - http
    - https
    - ftp
    - news
    - nntp
    - tel
    - telnet
    - mailto
    - irc
    - ssh
    - sftp
    - webcal
    - rtsp

I know how to do this by copying the services.yml file inside the sites/default folder but at this time I need to do this programmatically.
Any idea about how to do it?
You need a compiler pass:

Compiler passes give you an opportunity to manipulate other service
definitions that have been registered with the service container.

There are some Drupal specifics. An example which calculates a container parameter depending on tagged services is RegisterSerializationClassesCompilerPass. This class is registered in SerializationServiceProvider.
For simple use cases, where you don't need control over compiler pass priorities, you can use the alter() method of ServiceModifierInterface. This will then be executed in a shared core compiler pass ModifyServiceDefinitionsPass.
Example for adding foo to the filter protocols:
src/MymoduleServiceProvider.php
&lt;?php

namespace Drupal\mymodule;

use Drupal\Core\DependencyInjection\ContainerBuilder;
use Drupal\Core\DependencyInjection\ServiceProviderBase;

/**
 * Defines a service provider for the Mymodule module.
 */
class MymoduleServiceProvider extends ServiceProviderBase {

  /**
   * {@inheritdoc}
   */
  public function alter(ContainerBuilder $container) {
    $filter_protocols = $container-&gt;getParameter('filter_protocols');
    $filter_protocols[] = 'foo';
    $container-&gt;setParameter('filter_protocols', $filter_protocols);
  }

}