/** * Return Menu instance from the collection by key * * @param string $key * @return \Lavary\Menu\Item */ public function get($key) { return $this->collection->get($key); }
<v3:consumerID>XXXXX</v3:consumerID> <!--Optional:--> <v3:transactionID>56488</v3:transactionID> <v3:country>RWA</v3:country> <v3:correlationID>56488</v3:correlationID> </v3:GeneralConsumerInformation> </v3:RequestHeader> <v1:requestBody> <v1:initiatorAccount> <!--You have a CHOICE of the next 2 items at this level--> <v1:msisdn>250726049698</v1:msisdn> </v1:initiatorAccount> <v1:password>1515</v1:password> <v1:transactionId>85300</v1:transactionId> //RequestId </v1:requestBody> </v1:GetPurchaseStatusRequest> </soapenv:Body> </soapenv:Envelope>'; $xml = $response; //file_get_contents($response); // SimpleXML seems to have problems with the colon ":" in the <xxx:yyy> response tags, so take them out $xml = preg_replace("/(<\\/?)(\\w+):([^>]*>)/", "\$1\$2\$3", $xml); $xml = simplexml_load_string($xml); $json = json_encode($xml); $responseArray = json_decode($json, true); $collections = new Illuminate\Support\Collection($responseArray); $responseBody = $collections->get('soapenvBody'); dd(key($responseBody)); dd($xml, $json, $responseArray, $collections->get('soapenvBody')); });