cURL Converter - A tool convert cURL commands to Laravel's HTTP Client

Developer Tools

October 13th, 2022

cURL Converter - A tool convert cURL commands to Laravel's HTTP Client

Last week Shift released the cURL Converter. It allows you to quickly convert curl requests to an Http client request. Now all those example API calls you find within documentation can actually be used for your Laravel apps.

For example, take the following curl example from Fathom.

1curl https://api.usefathom.com/v1/account \
2 -H "Authorization: Bearer API_TOKEN_HERE"

Shift's cURL Converter outputs its equivalent Http request:

1Http::withToken('API_TOKEN_HERE')
2 ->get('https://api.usefathom.com/v1/account');

The underlying code for Shift's cURL Converter is available as a package on GitHub. This package provides an artisan command which wraps curl, allowing you to convert requests to Http code from the command line.

For convenience, Shift also has an online version of the tool. This allows you to quickly paste and convert curl requests. No need to install a Composer package.

If you’re interested in the development of this tool, JMac (Jason McCreary), the creator of Shift, live streamed coding it. You may also check out the laravel-shift/curl-converter repo to review its code or contribute.

Filed in:

Eric L. Barnes

Eric is the creator of Laravel News and has been covering Laravel since 2012.