The other day the namshi/cuzzle PHP pacakge came in really handy.
This library let’s you dump a Guzzle request to a cURL command for debug and log purposes
This way I could test some things on the CLI, and easily share these tests with all my colleagues, including those without PHP installed.
$request = new Request('GET', 'example.local');
$options = ;
echo (new CurlFormatter())->format($request, $options);
// ~> curl example.local -X GET -A 'GuzzleHttp/6.4.1 curl/7.71.1 PHP/7.4.9'
Also comes with a Monolog formatter to easily log the resulting curl commands in your log files. Do keep in mind that you might be leaking sensitive information (passwords/tokens) that way …
There’s a bug in Guzzle 6.5.0 in which it does not play nice with systems that have an older ICU library (which PHP’s Intl extension uses). CentOS 6 for example ships with a very old ICU version, without any (offical) means of updating it. The bug should be fixed in (the unreleased) Guzzle 6.5.1.
It is recommended that all PHP projects avoid Guzzle 6.5.0, by requiring Guzzle as follows:
And, as it turns out, the installed version on the CentOS 6 server that serves the project is lower than 4.6:
$ yum list installed icu
Unfortunately there's no official way of updating ICU to a more recent version on CentOS 6 (*), so a fix needs to happen on Guzzle's end. An issue has been reported with Guzzle and the fix should land in version 6.5.1.