$client = new \GuzzleHttp\Client(); $response = $client->delete('http://example.com/resource/1234'); $status = $response->getStatusCode();
$client = new \GuzzleHttp\Client(); $headers = [ 'Authorization' => 'Bearer ' . $token, 'Accept' => 'application/json', ]; $response = $client->delete('http://example.com/resource/1234', [ 'headers' => $headers, ]); $status = $response->getStatusCode();In both examples, we have used the GuzzleHttp\Client class to create an object of the client. We have then called the delete() method with the resource URL to be deleted. In the second example, we have added headers to the request by passing them in as an array to the options parameter. In conclusion, the examples demonstrate how easy it is to use the GuzzleHttp Client to make HTTP DELETE requests. The library used is GuzzleHttp, which is a popular PHP package for working with HTTP requests and web services.