如何在Laravel中访问XML或转换为JSON

I have this XML response:

<AuthorisationResult xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://webservice.redletterdays.co.uk/">
<RequestSuccessful>true</RequestSuccessful>
<ErrorMessage/>
<Token>3d3d4a94-87fe-414c-ae0a-fd0e0c4c0060</Token>
</AuthorisationResult>

enter image description here

That's what I got when I write:

return $res;

How can I access Token?

I try :

return $res->Token; 

and also

return $res->children();

but this code returns me errors...

SO, How I can access Token in XML or how to transform into JSON and easy access to Token like $res->Token ...

Try this:

$json = $res->getBody();
$array = json_decode($json);

dump($array);

I solve my problem with:

$res = json_encode(simplexml_load_string($res->getBody()));
$res = json_decode($res);
$token = $res->Token;