如何迭代guzzle响应

I am getting a guzzle response from an api request. Any idea how to iterate the response so I get the duration text and value. here is my response. I have tried to foreach but doesnt work:

array:1 [▼
  "elements" => array:1 [▼
    0 => array:3 [▼
      "distance" => array:2 [▼
        "text" => "293 mi"
        "value" => 470780
      ]
      "duration" => array:2 [▼
        "text" => "4 hours 50 mins"
        "value" => 17411
      ]
      "status" => "OK"
    ]
  ]

this is how I get this json

 $items = json_decode((string) $response->getBody(), true)['rows'][0];
        dd($items);

The response is encoded as json, so to use it you should decode it first to a php-array and then parse it.

Try this code:

$items = json_decode((string) $response->getBody(), true)['rows'][0];
foreach ($items['elements'] as $key => $item) {
    echo $item['duration']['text'] . ': '; 
    echo $item['duration']['value'] . '<br>';   
}