如何在Symfony HttpClient组件的CurlHttpClient中添加具有IP /端口和用户名/密码的代理?

I'm using Symfony HttpClient Component, it became necessary to use it with a proxy. Open proxy with the port, I can easily configure with the default configuration when instantiating CurlHttpClient class, but I can't set username and password for private proxy

Example of default configuration:

use Symfony\Component\HttpClient\CurlHttpClient;

$httpClient = new CurlHttpClient([
    'http_version' => '2.0',
    'proxy' => 'x.xx.xxx.xxx:8000',
]);

I try to add additional configuration on the extra options, and try other combinations, but can't find the right way.

with plain PHP and cURL everything works fine.

Please, help me, configure the Symfony HttpClient Component with a private proxy.

You need to specify protocol (e.g. socks5, socks4 etc)

use Symfony\Component\HttpClient\CurlHttpClient;

$httpClient = new CurlHttpClient([
    'http_version' => '2.0',
    'proxy' => 'socks5://username:password@127.0.0.1:9999',
]);

dump($httpClient->request('GET', 'https://api.ipify.org?format=json')->getContent());

I found the solution, the data for the proxy should be specified in the following format:

$httpClient = new CurlHttpClient([
    'http_version' => '2.0',
    'proxy' => 'user:password@ip:port',
]);

it wors fine