Skip to content

v2.9.0

Latest
Compare
Choose a tag to compare
@clue clue released this 03 Jul 10:47
· 2 commits to master since this release

A major feature release adding a new options APIs and more consistent APIs
for sending streaming requests. Includes a major documentation overhaul and
deprecates a number of APIs.

  • Feature: Add new request() and requestStreaming() methods and
    deprecate send() method and streaming option.
    (#170 by @clue)

    // old: deprecated
    $browser->withOptions(['streaming' => true])->get($url);
    $browser->send(new Request('OPTIONS', $url));
    
    // new
    $browser->requestStreaming('GET', $url);
    $browser->request('OPTIONS', $url);
  • Feature: Add dedicated methods to control options, deprecate withOptions().
    (#172 by @clue)

    // old: deprecated
    $browser->withOptions(['timeout' => 10]);
    $browser->withOptions(['followRedirects' => false]);
    $browser->withOptions(['obeySuccessCode' => false]);
    
    // new
    $browser->withTimeout(10);
    $browser->withFollowRedirects(false);
    $browser->withRejectErrorResponse(false);
  • Feature: Add withResponseBuffer() method to limit maximum response buffer size (defaults to 16 MiB).
    (#175 by @clue)

    // new: download maximum of 100 MB
    $browser->withResponseBuffer(100 * 1000000)->get($url);
  • Feature: Improve withBase() method and deprecate withoutBase() method
    (#173 by @clue)

    // old: deprecated
    $browser = $browser->withoutBase();
    
    // new
    $browser = $browser->withBase(null);
  • Deprecate submit() method, use post() instead.
    (#171 by @clue)

    // old: deprecated
    $browser->submit($url, $data);
    
    // new
    $browser->post($url, ['Content-Type' => 'application/x-www-form-urlencoded'], http_build_query($data));
  • Deprecate UriInterface for request methods, use URL strings instead.
    (#174 by @clue)

  • Fix: Fix unneeded timeout timer when request body closes and sender already rejected.
    (#169 by @clue)

  • Improve documentation structure, add documentation for all API methods and
    handling concurrency.
    (#167 and #176 by @clue)

  • Improve test suite to use ReactPHP-based webserver instead of httpbin and
    add forward compatibility with PHPUnit 9.
    (#168 by @clue)