PHPackages                             swisnl/guzzle-bugsnag-breadcrumbs-middleware - 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. swisnl/guzzle-bugsnag-breadcrumbs-middleware

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

swisnl/guzzle-bugsnag-breadcrumbs-middleware
============================================

Guzzle middleware that logs Bugsnag breadcrumbs

1.1.0(4y ago)02.7kMITPHPPHP &gt;=7.4

Since Jan 21Pushed 3y ago1 watchersCompare

[ Source](https://github.com/swisnl/guzzle-bugsnag-breadcrumbs-middleware)[ Packagist](https://packagist.org/packages/swisnl/guzzle-bugsnag-breadcrumbs-middleware)[ Docs](https://github.com/swisnl/guzzle-bugsnag-breadcrumbs-middleware)[ RSS](/packages/swisnl-guzzle-bugsnag-breadcrumbs-middleware/feed)WikiDiscussions master Synced today

READMEChangelog (1)Dependencies (5)Versions (3)Used By (0)

Guzzle middleware that logs Bugsnag breadcrumbs
===============================================

[](#guzzle-middleware-that-logs-bugsnag-breadcrumbs)

[![Latest Version on Packagist](https://camo.githubusercontent.com/c70cabe412dfc4755de2ad48f1830455a4760d7b991d3fdb2a172821ab9818d6/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f737769736e6c2f67757a7a6c652d627567736e61672d62726561646372756d62732d6d6964646c65776172652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/swisnl/guzzle-bugsnag-breadcrumbs-middleware)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Buy us a tree](https://camo.githubusercontent.com/cec0a9b35a1c3235bdbe0d13ea8fbd866a23e30280ad6ca27078c1fd4ac1b709/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f54726565776172652d2546302539462538432542332d6c69676874677265656e2e7376673f7374796c653d666c61742d737175617265)](https://plant.treeware.earth/swisnl/guzzle-bugsnag-breadcrumbs-middleware)[![Build Status](https://camo.githubusercontent.com/c3c6de17323035e786009d71891a36583fb7624d6600b2805a946acfe84ce7f6/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f636865636b732d7374617475732f737769736e6c2f67757a7a6c652d627567736e61672d62726561646372756d62732d6d6964646c65776172652f6d61737465723f6c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/swisnl/guzzle-bugsnag-breadcrumbs-middleware/actions/workflows/tests.yml)[![Coverage Status](https://camo.githubusercontent.com/7b60f0984c951deed9416e0f96debf08caadea1c492c6617557611ce7df88a2a/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f737769736e6c2f67757a7a6c652d627567736e61672d62726561646372756d62732d6d6964646c65776172652e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/swisnl/guzzle-bugsnag-breadcrumbs-middleware/code-structure)[![Quality Score](https://camo.githubusercontent.com/56ee28c32dc31d14c60f60b9833ffc2b1d5eb6eb57e2404fb0d0f49307887025/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f737769736e6c2f67757a7a6c652d627567736e61672d62726561646372756d62732d6d6964646c65776172652e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/swisnl/guzzle-bugsnag-breadcrumbs-middleware)[![Total Downloads](https://camo.githubusercontent.com/2eeada702ed374a05ce2197edf87563dcb79435e75c237eb2606f11bd09f17b1/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f737769736e6c2f67757a7a6c652d627567736e61672d62726561646372756d62732d6d6964646c65776172652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/swisnl/guzzle-bugsnag-breadcrumbs-middleware)[![Made by SWIS](https://camo.githubusercontent.com/ef6bdd6ab8d4f47bceb74dcf558b0915c6b419cbba320096324af0518e43091d/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f2546302539462539412538302d6d6164652532306279253230535749532d2532333037333741392e7376673f7374796c653d666c61742d737175617265)](https://www.swis.nl)

This is a [middleware](https://docs.guzzlephp.org/en/stable/handlers-and-middleware.html#middleware) for Guzzle 7 that leaves [Bugsnag breadcrumbs](https://docs.bugsnag.com/platforms/php/other/#logging-breadcrumbs) for all requests.

⚠️ Please make sure you don't log sensitive information to Bugsnag and properly configure this middleware to redact secrets. ⚠️

Install
-------

[](#install)

Via Composer

```
composer require swisnl/guzzle-bugsnag-breadcrumbs-middleware
```

Usage
-----

[](#usage)

```
use Bugsnag\Client as Bugsnag;
use GuzzleHttp\Client as Guzzle;
use GuzzleHttp\HandlerStack;
use Swis\Guzzle\Bugsnag\BreadcrumbMiddleware;

$bugsnag = Bugsnag::make();

$stack = HandlerStack::create();
$stack->push(new BreadcrumbMiddleware($bugsnag));
$client = new Guzzle(['handler' => $stack]);
```

Now when you send a request, a Bugsnag breadcrumb is logged with the following metadata:

- method
- uri
- status code
- response body (summary), in case of client or server exceptions (status code &gt;= 400)
- duration

### Laravel

[](#laravel)

Using Laravel? Simply use the factory method to create the middleware from the Bugsnag facade: `BreadcrumbMiddleware::fromFacade()`.

Config
------

[](#config)

You can configure the middleware using the constructor arguments:

### `$bugsnag`

[](#bugsnag)

Your (preconfigured) Bugsnag client.

### `$name`

[](#name)

The name of the breadcrumb.

### `$redactedStrings`

[](#redactedstrings)

A list of secret strings, such as API keys, that should be filtered out of the metadata.

### `$truncateBodyAt`

[](#truncatebodyat)

The length of the response body summary, which is added to the breadcrumb in case of client or server exceptions. Use null to disable logging response/request body.

By default, it does not log the request body and only logs the response body in case of client or server exceptions (status code &gt;= 400). If you'd like to change this behaviour, you can provide your own `GuzzleHttp\BodySummarizerInterface` implementation. You can use the default `GuzzleHttp\BodySummarizer` for example, to log all request and response bodies. Please be aware not to log sensitive information!

Change log
----------

[](#change-log)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Testing
-------

[](#testing)

```
composer test
```

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) and [CODE\_OF\_CONDUCT](CODE_OF_CONDUCT.md) for details.

Security
--------

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Jasper Zonneveld](https://github.com/JaZo)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

This package is [Treeware](https://treeware.earth). If you use it in production, then we ask that you [**buy the world a tree**](https://plant.treeware.earth/swisnl/guzzle-bugsnag-breadcrumbs-middleware) to thank us for our work. By contributing to the Treeware forest you’ll be creating employment for local families and restoring wildlife habitats.

SWIS ❤️ Open Source
-------------------

[](#swis-heart-open-source)

[SWIS](https://www.swis.nl) is a web agency from Leiden, the Netherlands. We love working with open source software.

###  Health Score

26

—

LowBetter than 46% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity50

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~2 days

Total

2

Last Release

1518d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/8734305?v=4)[SWIS](/maintainers/swisnl)[@swisnl](https://github.com/swisnl)

---

Top Contributors

[![JaZo](https://avatars.githubusercontent.com/u/3475007?v=4)](https://github.com/JaZo "JaZo (14 commits)")

---

Tags

hacktoberfestmiddlewareGuzzlebugsnagbreadcrumbsswisnl

###  Code Quality

TestsPHPUnit

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/swisnl-guzzle-bugsnag-breadcrumbs-middleware/health.svg)

```
[![Health](https://phpackages.com/badges/swisnl-guzzle-bugsnag-breadcrumbs-middleware/health.svg)](https://phpackages.com/packages/swisnl-guzzle-bugsnag-breadcrumbs-middleware)
```

###  Alternatives

[kevinrob/guzzle-cache-middleware

A HTTP/1.1 Cache for Guzzle 6. It's a simple Middleware to be added in the HandlerStack. (RFC 7234)

43317.0M98](/packages/kevinrob-guzzle-cache-middleware)[caseyamcl/guzzle_retry_middleware

Guzzle v6+ retry middleware that handles 429/503 status codes and connection timeouts

21910.3M56](/packages/caseyamcl-guzzle-retry-middleware)[rtheunissen/guzzle-log-middleware

Guzzle middleware to log requests and responses

812.2M17](/packages/rtheunissen-guzzle-log-middleware)[eljam/guzzle-jwt-middleware

A jwt authentication middleware for guzzle 6

28708.7k3](/packages/eljam-guzzle-jwt-middleware)[rtheunissen/guzzle-rate-limiter

Guzzle 6 middleware used to delay requests dynamically

56175.3k1](/packages/rtheunissen-guzzle-rate-limiter)[brightfish/caching-guzzle

Cache HTTP responses through Guzzle middleware

1031.2k](/packages/brightfish-caching-guzzle)

PHPackages © 2026

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