owox/artax-dumper

v0.0.3 2018-11-25 22:24 UTC

This package is not auto-updated.

Last update: 2024-05-08 07:46:20 UTC


README

Build Status Coverage Status License: MIT PHPStan

Install it with:

composer require owox/artax-dumper

Only curl request dumper hugely inspired by cuzzle available for now. It can be used for copy/paste requests logging:

\Amp\Loop::run(static function () {
    $curlRequestDumper = new \ArtaxDumper\Request\CurlRequestDumper();
    
    // GET Request
    $request = new \Amp\Artax\Request('https://httpbin.org/get');
    
    $curl = yield $curlRequestDumper->dump($request); // => curl "https://httpbin.org/get"
    
    // POST Request
    $request = (new \Amp\Artax\Request($uri = 'https://httpbin.org/post', 'POST'))
        ->withBody($body = 'foo=bar');
    
    $curl = yield $curlRequestDumper->dump($request); // => curl -d "foo=bar" "https://httpbin.org/post"
});