Skip to main content

See every call Symfony HttpClient makes

To see what Symfony HttpClient sends and what comes back, set its proxy option to http://127.0.0.1:8080 and turn off TLS verification. Every call then goes through Buggregator's HTTP proxy, and the UI shows the request, the response, the status code and the response time. Use it in development only.

Steps

1. Start Buggregator with the proxy port

The proxy listens on port 8080; the UI is on port 8000. Bind the proxy to your machine only: it forwards to any host.

bash
docker run --pull always \
  -p 127.0.0.1:8000:8000 \
  -p 127.0.0.1:8080:8080 \
  ghcr.io/buggregator/server:latest

2. Set the proxy on one client

Pass proxy and switch off peer and host verification. In Docker Compose, replace 127.0.0.1 with the Buggregator service name, for example buggregator.

php
use Symfony\Component\HttpClient\HttpClient;

$client = HttpClient::create([
    'proxy' => 'http://127.0.0.1:8080',
    'verify_peer' => false,
    'verify_host' => false,
]);

$response = $client->request('GET', 'https://api.example.com/users');

3. Or set it for the whole app in dev

In a Symfony app, put the same options under the framework's HTTP client defaults, for the dev environment only.

yaml
# config/packages/framework.yaml
when@dev:
    framework:
        http_client:
            default_options:
                proxy: 'http://127.0.0.1:8080'
                verify_peer: false
                verify_host: false

4. Read the request and response

Make a call, then open http://127.0.0.1:8000. Proxied calls carry a purple proxy badge. The detail page has Response, Request and Raw tabs, a JSON tree for the response body, a color-coded status code and the time in milliseconds.

Why it works

For HTTPS, the proxy answers the CONNECT handshake with a certificate for the target host, signed by a CA it keeps in memory, then forwards the request to the real server. Your client skips certificate verification, so you install no CA. The proxy stores the request and the response together as one event. Your code that calls the API does not change.

Checked on with Buggregator v2.13.0

Setup in 60 seconds

No registration. No account. Start it and point your app at it.

1

Start Buggregator

One file, installed with one command. The web UI opens on port 8000. Prefer containers? Use the Docker tab.

$ curl -fsSL https://raw.githubusercontent.com/buggregator/server/master/scripts/install.sh | sh
$ HTTP_ADDR=127.0.0.1:8000 \
  SMTP_ADDR=127.0.0.1:1025 \
  VAR_DUMPER_ADDR=127.0.0.1:9912 \
  MONOLOG_ADDR=127.0.0.1:9913 \
  PROXY_ADDR=127.0.0.1:8080 \
  ~/.local/bin/buggregator

The script picks the file for your CPU: Intel/AMD or ARM.

One file for Linux, macOS and Windows, about 40 MB. Nothing else to install.

This run line keeps it on this computer. Without the *_ADDR settings it listens on all network interfaces

Rather not run a script? Download the file yourself

Runs on Windows, macOS and Linux, on Intel/AMD and ARM.

Prefer not to do it yourself? Your AI agent can set Buggregator up for you