I'm using Symfony 4.4.7 and making http requests with HTTPClient (Symfony\Component\HttpClient\HttpClient) but requests doesn't shown in profiler. How to make this profiler tab work?
I'm using Symfony 4.4.7 and making http requests with HTTPClient (Symfony\Component\HttpClient\HttpClient) but requests doesn't shown in profiler. How to make this profiler tab work?
I solved it.
You should use HttpClient using Dependency Injection then requests will appear in Profiler.
// services.yaml
App\Service\SomeService:
arguments:
$httpClient: '@http_client'
...
use Symfony\Contracts\HttpClient\HttpClientInterface;
...
class SomeService
{
protected $httpClient;
public function __construct(HttpClientInterface $httpClient)
{
$this->httpClient = $httpClient;
}
...
}