PHPackages                             simonberger/buzz - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [HTTP &amp; Networking](/categories/http)
4. /
5. simonberger/buzz

AbandonedArchivedLibrary[HTTP &amp; Networking](/categories/http)

simonberger/buzz
================

Lightweight HTTP client

1.2.0(5y ago)01811MITPHPPHP ^7.1 || ^8.0

Since Nov 11Pushed 4y agoCompare

[ Source](https://github.com/simonberger/Buzz)[ Packagist](https://packagist.org/packages/simonberger/buzz)[ Docs](https://github.com/kriswallsmith/Buzz)[ RSS](/packages/simonberger-buzz/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (9)Versions (36)Used By (1)

Buzz - Scripted HTTP browser
============================

[](#buzz---scripted-http-browser)

[![Build Status](https://github.com/kriswallsmith/Buzz/workflows/Tests/badge.svg)](https://github.com/kriswallsmith/Buzz/workflows/Tests/badge.svg)[![BC Check](https://github.com/kriswallsmith/Buzz/workflows/BC%20Check/badge.svg)](https://github.com/kriswallsmith/Buzz/workflows/BC%20Check/badge.svg)[![Latest Version](https://camo.githubusercontent.com/f6a9f8e7d40d7040ba056dee39373ebe3f21080833ccd4aa77fea3a8b79f4a42/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f6b72697377616c6c736d6974682f42757a7a2e7376673f7374796c653d666c61742d737175617265)](https://github.com/kriswallsmith/Buzz/releases)[![Code Coverage](https://camo.githubusercontent.com/add84595dfc585ae08892a183b90f4c1d110908e8aa543f5077dd7803a1b339b/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f6b72697377616c6c736d6974682f42757a7a2e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/kriswallsmith/Buzz)[![Quality Score](https://camo.githubusercontent.com/658617f1889809483ec75db65ddcd2de89f59d766288bad79d202f2bb2c85036/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f6b72697377616c6c736d6974682f42757a7a2e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/kriswallsmith/Buzz)[![Total Downloads](https://camo.githubusercontent.com/ed7b787e309e18e86c60907fda9d88fe9c040183ab22b95ef3d7e00976b49f04/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6b72697377616c6c736d6974682f62757a7a2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/kriswallsmith/buzz)[![Monthly Downloads](https://camo.githubusercontent.com/819619f5538e386f50a90b573b3175b7443ecaad4fc061be27976a93b0218cf6/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646d2f6b72697377616c6c736d6974682f62757a7a2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/kriswallsmith/buzz)

Buzz is a lightweight (&lt;1000 lines of code) PHP 7.1 library for issuing HTTP requests. The library includes three clients: `FileGetContents`, `Curl` and `MultiCurl`. The `MultiCurl` supports batch requests and HTTP2 server push.

Installation
------------

[](#installation)

Install by running:

```
composer require kriswallsmith/buzz
```

You do also need to install a PSR-17 request/response factory. Buzz uses that factory to create PSR-7 requests and responses. Install one from [this list](https://packagist.org/providers/psr/http-factory-implementation).

Example:

```
composer require nyholm/psr7
```

Usage
-----

[](#usage)

This page will just show you the basics, please [read the full documentation](doc/).

```
use Buzz\Browser;
use Buzz\Client\FileGetContents;

$client = new FileGetContents(new Psr17ResponseFactory());
$browser = new Browser($client, new Psr17RequestFactory());
$response = $browser->get('https://www.google.com');

echo $browser->getLastRequest()."\n";
// $response is a PSR-7 object.
echo $response->getStatusCode();
```

You can also use the low-level HTTP classes directly.

```
use Buzz\Client\FileGetContents;

$request = new PSR7Request('GET', 'https://google.com/foo');

$client = new FileGetContents(new Psr17ResponseFactory());
$response = $client->sendRequest($request, ['timeout' => 4]);

echo $response->getStatusCode();
```

### Note

[](#note)

The two `new Psr17ResponseFactory()` and `new Psr17RequestFactory()` are placeholders for whatever PSR-17 factory you choose. If you use `nyholm/psr7` then the example above would start like:

```
use Buzz\Browser;
use Buzz\Client\FileGetContents;
use Nyholm\Psr7\Factory\Psr17Factory;

$client = new FileGetContents(new Psr17Factory());
$browser = new Browser($client, new Psr17Factory());
$response = $browser->get('https://www.google.com');
```

### HTTP2 server push

[](#http2-server-push)

Buzz MultiCurl client support HTTP2 server push.

```
use Buzz\Client\MultiCurl;
use Nyholm\Psr7\Factory\Psr17Factory;
use Nyholm\Psr7\Request;

$client = new MultiCurl(new Psr17Factory());

$start = microtime(true);
$response = $client->sendRequest(new Request('GET', 'https://http2.golang.org/serverpush', [], null, '2.0'));
$timeFirstRequest = microtime(true) - $start;

// Parse response to find asset version.
$body = $response->getBody()->__toString();
$id = null;
if (preg_match('#/serverpush/static/style.css\?([0-9]+)#sim', $body, $matches)) {
    $id = $matches[1];
}

// Make two new requests
$start = microtime(true);
$client->sendRequest(new Request('GET', 'https://http2.golang.org/serverpush/static/style.css?'.$id));
$client->sendRequest(new Request('GET', 'https://http2.golang.org/serverpush/static/playground.js?'.$id));
$timeOtherRequests = microtime(true) - $start;

echo 'First: '.$timeFirstRequest."\n";
echo 'Other: '.$timeOtherRequests."\n";
```

Since the two other requests was pushed, we spend no time fetching those.

```
First: 1.04281
Other: 0.00027

```

You can configure what request you want to accept as pushed with the `push_function_callback` option.

The Idea of Buzz
----------------

[](#the-idea-of-buzz)

Buzz was created by Kris Wallsmith back in 2010. The project grown very popular over the years with more than 7 million downloads.

Since August 2017 [Tobias Nyholm](http://tnyholm.se) is maintaining this library. The idea of Buzz will still be the same, we should have a simple API and mimic browser behavior for easy testing. We should not reinvent the wheel and we should not be as powerful and flexible as other clients (ie Guzzle). We do, however, take performance very seriously.

We do love PSRs and this is a wish list of what PSR we would like to support:

- PSR-1 (Code style)
- PSR-2 (Code style)
- PSR-4 (Auto loading)
- PSR-7 (HTTP messages)
- PSR-17 (HTTP factories)
- PSR-18 (HTTP client)

The goal
--------

[](#the-goal)

Since the release of 1.0 Buzz has reached its goal of being a lightweight client that covers 90% of all use cases. There are no plans to actively develop new features or change the existing API. There are alternatives for people that wants an more actively maintained HTTP clients. One that is particularly popular and got a big community behind it is the
[Symfony HTTP Client](https://github.com/symfony/http-client).

Contribute
----------

[](#contribute)

Buzz is great because it is small, simple and yet flexible. We are always happy to receive bug reports and bug fixes. We are also looking forward to review a pull request with a new middleware, especially if the middleware covers a common use case.

We will probably not accept any configuration option or feature to any of the clients or the Browser.

Backwards Compatibility Promise
-------------------------------

[](#backwards-compatibility-promise)

We take backwards compatibility very seriously as you should do with any open source project. We strictly follow [Semver](https://semver.org/). Please note that Semver works a bit different prior version 1.0.0. Minor versions prior 1.0.0 are allow to break backwards compatibility.

Being greatly inspired by [Symfony's bc promise](https://symfony.com/doc/current/contributing/code/bc.html), we have adopted their method of deprecating classes, interfaces and functions.

Running the tests
-----------------

[](#running-the-tests)

There are 2 kinds of tests for this library; unit tests and integration tests. They can be run separably by:

```
./vendor/bin/phpunit --testsuite Unit
./vendor/bin/phpunit --testsuite Integration
```

The integration tests makes real HTTP requests to a webserver. There are two different webservers used by our integration tests. A real Nginx server and PHP's built in webserver. The tests that runs with PHP's webserver are provided by `php-http/client-integration-tests`.

To start the server, open terminal A and run:

```
./vendor/bin/http_test_server
```

The other type of integration tests are using Nginx. We use Docker to start the Nginx server.

```
docker build -t buzz/tests .
docker run -d -p 127.0.0.1:8022:80 buzz/tests
```

You are now ready to run the integration tests

```
./vendor/bin/phpunit --testsuite Integration
```

### Test Server Push

[](#test-server-push)

To use HTTP/2 server push you need to run the very latest PHP version. PHP also need to use cUrl &gt; 7.61.1 and be compiled with libnghttp2. You can use docker:

```
composer update
docker run -it --rm --name php-latest -v  "$PWD":/usr/src/myapp -w /usr/src/myapp tommymuehle/docker-alpine-php-nightly \
  php vendor/bin/phpunit tests/Integration/MultiCurlServerPushTest.php
```

###  Health Score

35

—

LowBetter than 80% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community21

Small or concentrated contributor base

Maturity80

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 53.8% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~114 days

Recently: every ~1 days

Total

34

Last Release

1517d ago

Major Versions

0.17.2 → 1.0.0-beta12018-11-01

PHP version history (7 changes)v0.3PHP &gt;=5.3.0

v0.15.1PHP ^5.3.3 || ^7.0

v0.16.0PHP ^5.4 || ^7.0

v0.17.0PHP ^7.1

1.2.0PHP ^7.1 || ^8.0

0.16.2PHP ^5.4 || ^7.0 || ^8.0

0.16.5PHP &gt;=7.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/1dc92224f3b14b4d309f490f703b91c833942ea3603a6bcbe15d58a08f7ea4fe?d=identicon)[simonberger](/maintainers/simonberger)

---

Top Contributors

[![kriswallsmith](https://avatars.githubusercontent.com/u/33886?v=4)](https://github.com/kriswallsmith "kriswallsmith (247 commits)")[![Nyholm](https://avatars.githubusercontent.com/u/1275206?v=4)](https://github.com/Nyholm "Nyholm (127 commits)")[![stloyd](https://avatars.githubusercontent.com/u/67402?v=4)](https://github.com/stloyd "stloyd (9 commits)")[![Seldaek](https://avatars.githubusercontent.com/u/183678?v=4)](https://github.com/Seldaek "Seldaek (7 commits)")[![troelskn](https://avatars.githubusercontent.com/u/37910?v=4)](https://github.com/troelskn "troelskn (7 commits)")[![GeLoLabs](https://avatars.githubusercontent.com/u/149005863?v=4)](https://github.com/GeLoLabs "GeLoLabs (6 commits)")[![dol](https://avatars.githubusercontent.com/u/41777?v=4)](https://github.com/dol "dol (5 commits)")[![rybakit](https://avatars.githubusercontent.com/u/533861?v=4)](https://github.com/rybakit "rybakit (5 commits)")[![jfsimon](https://avatars.githubusercontent.com/u/119407?v=4)](https://github.com/jfsimon "jfsimon (4 commits)")[![peterfrankjohnson](https://avatars.githubusercontent.com/u/473931?v=4)](https://github.com/peterfrankjohnson "peterfrankjohnson (4 commits)")[![honzatrtik](https://avatars.githubusercontent.com/u/1225333?v=4)](https://github.com/honzatrtik "honzatrtik (4 commits)")[![Koc](https://avatars.githubusercontent.com/u/191082?v=4)](https://github.com/Koc "Koc (4 commits)")[![lyrixx](https://avatars.githubusercontent.com/u/408368?v=4)](https://github.com/lyrixx "lyrixx (4 commits)")[![sunkan](https://avatars.githubusercontent.com/u/568492?v=4)](https://github.com/sunkan "sunkan (3 commits)")[![mheap](https://avatars.githubusercontent.com/u/59130?v=4)](https://github.com/mheap "mheap (3 commits)")[![asm89](https://avatars.githubusercontent.com/u/657357?v=4)](https://github.com/asm89 "asm89 (2 commits)")[![bburnichon](https://avatars.githubusercontent.com/u/2437286?v=4)](https://github.com/bburnichon "bburnichon (2 commits)")[![everzet](https://avatars.githubusercontent.com/u/30813?v=4)](https://github.com/everzet "everzet (2 commits)")[![marijn](https://avatars.githubusercontent.com/u/65233?v=4)](https://github.com/marijn "marijn (2 commits)")[![stof](https://avatars.githubusercontent.com/u/439401?v=4)](https://github.com/stof "stof (2 commits)")

---

Tags

curlhttp client

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/simonberger-buzz/health.svg)

```
[![Health](https://phpackages.com/badges/simonberger-buzz/health.svg)](https://phpackages.com/packages/simonberger-buzz)
```

###  Alternatives

[kriswallsmith/buzz

Lightweight HTTP client

2.0k31.3M443](/packages/kriswallsmith-buzz)[php-http/curl-client

PSR-18 and HTTPlug Async client with cURL

48247.0M384](/packages/php-http-curl-client)[phpro/http-tools

HTTP tools for developing more consistent HTTP implementations.

28137.8k](/packages/phpro-http-tools)[laudis/neo4j-php-client

Neo4j-PHP-Client is the most advanced PHP Client for Neo4j

184616.9k31](/packages/laudis-neo4j-php-client)[voku/httpful

A Readable, Chainable, REST friendly, PHP HTTP Client

16183.9k1](/packages/voku-httpful)[art4/requests-psr18-adapter

Use WordPress/Requests as a PSR-18 HTTP client

153.3k](/packages/art4-requests-psr18-adapter)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
