On the Cloudflare blog there's a new post with an example of how to test APIs with Guzzle, a popular HTTP client for PHP. In their example they're focusing on the testing of REST APIs.
[...] In this post I'll be demonstrating how you can test RESTful APIs in an automated fashion using PHP, by building a testing framework through creative use of two packages - Guzzle and PHPUnit. The resulting tests will be something you can run outside of your API as part of your deployment or CI (Continuous Integration) process.
They start by setting up their testing environment, using Composer to install both the Guzzle HTTP client and the PHPUnit testing tool. They then create the example
phpunit.xml configuration file and writing a first test. Their example runs a test against the "/user-agent" endpoint on httpbin.org, verifying that the response code is 200, content type of the return is correct and that the body contains the string "Guzzle". They build on this adding another test for a failure (a 405 response code) from a
PUT request on the same endpoint.