9951 explained code solutions for 126 technologies


php-guzzleHow to install PHP Guzzle with Composer?


  1. Install Composer on your system.
  2. Create a composer.json file in the root of your project and add the following code:
{
    "require": {
        "guzzlehttp/guzzle": "^6.3"
    }
}
  1. Run composer install in the root of your project.
  2. Include the autoloader in your project:
require 'vendor/autoload.php';
  1. Use Guzzle in your project:
$client = new \GuzzleHttp\Client();
$response = $client->request('GET', 'https://example.com');
echo $response->getStatusCode(); // 200

Edit this code on GitHub