PHPackages                             cviebrock/guzzle-stripbom-plugin - 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. cviebrock/guzzle-stripbom-plugin

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

cviebrock/guzzle-stripbom-plugin
================================

Plug-in for Guzzle that strips BOMs from server responses

0.1.3(12y ago)543411MITPHPPHP &gt;=5.3.2

Since Sep 24Pushed 12y ago1 watchersCompare

[ Source](https://github.com/cviebrock/guzzle-stripbom-plugin)[ Packagist](https://packagist.org/packages/cviebrock/guzzle-stripbom-plugin)[ Docs](https://github.com/cviebrock/guzzle-stripbom-plugin)[ RSS](/packages/cviebrock-guzzle-stripbom-plugin/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependencies (1)Versions (3)Used By (1)

guzzle-stripbom-plugin
======================

[](#guzzle-stripbom-plugin)

Plug-in for [Guzzle](http://guzzlephp.org/) that strips BOMs from server responses.

Usage
-----

[](#usage)

In your project's `composer.json` file:

```
	"require": {
		"cviebrock/guzzle-stripbom-plugin": "0.1.*",
	}

```

In your code:

```
$client = new Guzzle\Http\Client('http://example.com');

$client->addSubscriber( new Cviebrock\Guzzle\Plugin\StripBom\StripBomPlugin() );

$request = $client->get('some/request');

$response = $client->send($request);

$data = $response->json();
```

Why?
----

[](#why)

Some API services (mostly .NET services) include a [BOM](http://en.wikipedia.org/wiki/Byte_order_mark) in their response body. The BOM is 2-4 bytes that indicate what character encoding the response is in (e.g. UTF8). The problem is that PHP's `json_decode()` function and `SimpleXML` classes barf when trying to parse strings that include a BOM. If you are getting a "Can't parse JSON" error when handling a request, but it looks like JSON to you, this is likely what's happening.

This plugin strips those bytes off if they exist, before any JSON/XML parsing.

Kudos? Questions? Complaints?
-----------------------------

[](#kudos--questions--complaints)

Please use the [issue tracker](https://github.com/cviebrock/guzzle-stripbom-plugin/issues).

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity18

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity49

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

Unknown

Total

1

Last Release

4614d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/a3b6c8249f9ade65deeb3667fdf717ca934828c0c5fd2341dfdb62ab01414791?d=identicon)[cviebrock](/maintainers/cviebrock)

---

Top Contributors

[![cviebrock](https://avatars.githubusercontent.com/u/166810?v=4)](https://github.com/cviebrock "cviebrock (17 commits)")

---

Tags

jsonpluginxmlGuzzlebom

### Embed Badge

![Health badge](/badges/cviebrock-guzzle-stripbom-plugin/health.svg)

```
[![Health](https://phpackages.com/badges/cviebrock-guzzle-stripbom-plugin/health.svg)](https://phpackages.com/packages/cviebrock-guzzle-stripbom-plugin)
```

###  Alternatives

[tcdent/php-restclient

A generic REST API client for PHP

3542.9M29](/packages/tcdent-php-restclient)[serpapi/google-search-results-php

Get Google, Bing, Baidu, Ebay, Yahoo, Yandex, Home depot, Naver, Apple, Duckduckgo, Youtube search results via SerpApi.com

69114.3k](/packages/serpapi-google-search-results-php)[hgg/pardot

Pardot API library for building custom CRM connectors

2399.6k](/packages/hgg-pardot)

PHPackages © 2026

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