php - Guzzle 6: no more json() method for responses -
previously in guzzle 5.3:
$response = $client->get('http://httpbin.org/get'); $array = $response->json(); // yoohoo var_dump($array[0]['origin']);
i php array json response. in guzzle 6, don't know how do. there seems no json()
method anymore. (quickly) read doc latest version , don't found json responses. think missed something, maybe there new concept don't understand (or maybe did not read correctly).
is (below) new way way?
$response = $client->get('http://httpbin.org/get'); $array = json_decode($response->getbody()->getcontents(), true); // :'( var_dump($array[0]['origin']);
or there helper or that?
i use json_decode($response->getbody())
instead of $response->json()
.
i suspect might casualty of psr-7 compliance.
Comments
Post a Comment