$response->setBody("Hello World!");
$response->setBody(json_encode(["name" => "John", "age" => 30]));In the above examples, we are setting the response body as plain text and JSON respectively. This method is commonly used in PHP packages/libraries that deal with HTTP requests and responses. Some popular packages that use this method are Laravel and Symfony.