Library: GuzzleHttp

Convert cURL to PHP (Guzzle)

Convert cURL to modern PHP utilizing the Guzzle HTTP client with associative arrays for headers and bodies.

Input cURL Command
Generated PHP (Guzzle) Code
<?php
require 'vendor/autoload.php';

use GuzzleHttp\Client;

$client = new Client();
$response = $client->request('POST', 'https://api.example.com/v1/invoices', [
    'headers' => [
        'Content-Type' => 'application/json',
    ],
        'body' => '{"amount": 150}'
]);

echo "Status: " . $response->getStatusCode() . "\n";
echo "Body: " . $response->getBody()->getContents() . "\n";
Frequently Asked Questions

cURL to PHP (Guzzle) Questions & Answers

Common questions regarding API payload conversion, header extraction, and client-side privacy.

Paste your cURL command into the input box above. DevTransform parses headers (-H), request method (-X), URL parameters, and JSON payloads (-d) entirely client-side in your browser and outputs native PHP code in 0 milliseconds.