cURL to PHP Guzzle
Convert cURL commands into PHP Guzzle client code — json, form_params, multipart and auth options included.
Tool input is processed locally in your browser and is not submitted to CodeNimbleTools. Avoid pasting production secrets into any device or website you do not fully trust.
About this tool
Guzzle is PHP's standard HTTP client, but translating cURL flags to its options array takes documentation-diving. This tool parses the command and writes the full Guzzle request: JSON bodies become 'json' =>, URL-encoded data becomes 'form_params', uploads become 'multipart', and -u becomes 'auth'.
Boilerplate (require + use statements) is optional so you can paste into existing code.
How to use it
- Paste the cURL command.
- Toggle boilerplate if you need a standalone script.
- Copy the generated PHP.
- Run it in any project with guzzlehttp/guzzle installed.
Useful ways to apply it
- Implementing a third-party API from its cURL-only documentation.
- Migrating shell-based integrations into a Laravel/Symfony app.
- Generating consistent Guzzle snippets across a team.
- Learning how cURL concepts map to Guzzle options.
Worked example
Example input
curl -X POST 'https://api.example.com/items' -H 'Content-Type: application/json' -d '{"name":"Ada"}'
Expected output
$client->request('POST', 'https://api.example.com/items', ['json' => ['name' => 'Ada']]);
Edge cases to check
- Guzzle options differ from raw cURL flags.
- Streaming uploads, client certificates and proxy options require application-specific review.
- Never hard-code production bearer tokens into generated source.
Known limitations
The converter targets common Guzzle request patterns and does not cover every cURL transport feature.
How this tool was reviewed
Reviewed with methods, JSON/form bodies, headers and bearer authentication examples.
Standards and technical references
See the site-wide testing methodology for fixture categories, privacy checks and correction policy.
Frequently asked questions
Which body types are recognized?
Is -k / --insecure handled?
Which Guzzle version is targeted?
Privacy
Tool input is processed locally in your browser and is not submitted to CodeNimbleTools. Avoid pasting production secrets into any device or website you do not fully trust.