Files
2025-08-02 16:30:27 +02:00

29 lines
586 B
PHP

<?php
declare(strict_types=1);
namespace KupShop\KupShopBundle\Util\System;
use Symfony\Component\HttpClient\CurlHttpClient;
class CurlUtil
{
public const defaultOpt = [
'extra' => [
'curl' => [
CURLOPT_TCP_KEEPALIVE => 1,
],
],
// Timeout
'max_duration' => 5,
];
/**
* @param $headers array
*/
public function getClient(array $headers = [], array $options = []): CurlHttpClient
{
return new CurlHttpClient($options + ['headers' => $headers] + self::defaultOpt);
}
}