Skip to content

Guzzle

A PHP library for sending HTTP requests to web services, both synchronously and asynchronously.

Stars
23.4k
Forks
2.4k
Licence
MIT
Language
PHP
Last update
11 days ago
Type
Library

What it is

Guzzle is a PHP library that lets a PHP program send HTTP requests, such as fetching data from or posting data to a web API. It handles things like query strings, JSON bodies, cookies, and large uploads or downloads through one interface. Developers use it so they don't have to write low-level request code themselves.

  • Fetch a JSON record from a third-party API and read the status code and body
  • Upload large files as streams without loading them fully into memory
  • Send several HTTP requests asynchronously using the same interface
  • Add custom middleware to log, retry, or modify requests and responses

Great for

  • PHP developers who need to call external REST or web service APIs
  • Projects that want synchronous and asynchronous requests through the same interface
  • Teams that want code not tied to a specific transport like cURL or PHP streams
  • Developers who want to extend request behavior with middleware

Not ideal for

  • Non-PHP projects, since it only runs in PHP (it requires PHP 7.4 or later for version 8.3)
  • People who only need a browser-based tool or a command-line HTTP client with no coding
  • Projects on very old PHP versions, because support depends on the version table in the README
Step-by-step guide: how to use GuzzleInstall, first run, examples, tips and FAQs

How to get it

  1. 1

    Install with a package manager

    You'll need: PHP 7.4 or later (for version 8.3) · Composer

    Install with Composer

    composer require guzzlehttp/guzzle
  2. 2

    Run it

    • Install Guzzle with Composer using the command above
    • Create a client with $client = new \GuzzleHttp\Client();
    • Send a request with $client->request('GET', url)
    • Read the status code and body from the returned response
  3. 3

    Get the most out of it

    • Read the Request Options doc to control headers, timeouts and other request settings
    • Use the Middleware doc to add custom behavior to every request
    • Use the Testing Guzzle Clients doc to test code that makes HTTP calls
    • Check the Uploading Data and Cookies docs for those specific features

Downloads

Strengths

  • Supports both synchronous and asynchronous requests with one interface
  • Uses PSR-7 and PSR-18 standards, so it works with other compatible libraries
  • Has a documented middleware system for extending behavior

Trade-offs

  • Requires PHP and Composer, so it is not useful for non-PHP projects
  • The README is truncated here, so detailed API behavior must be checked in the linked docs
  • Version support differs by release, so older PHP projects may need an older Guzzle line

How it compares

ProjectStarsTypeLevelUpdatedBest for
guzzle (this)23.4kLibraryintermediate11 days agoPHP developers who need to call external REST or web service APIs
Slim12.3kFrameworkintermediate5 days agoPHP developers who want a lightweight alternative to a full-stack framework
monolog21.4kLibraryintermediate5 days agoPHP developers who need structured logs from an application
got15kLibrarybeginner7 days agoNode.js developers who call web APIs from server-side code
flysystem13.6kLibraryintermediate1 months agoPHP developers who need to store files in more than one place
uuid12.6kLibrarybeginner2 months agoPHP developers who need unique IDs for database records or API objects

Stats synced from GitHub. The assessment above was drafted with AI from the project's README on 2026-10-29 and may miss recent changes — check the README before relying on a command. MIT licence: free to use, modify and distribute, including commercially, as long as you keep the copyright notice.