PHPackages                             fab2s/bom - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. fab2s/bom

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

fab2s/bom
=========

Purely static zero dependencies BOM Helper to handle unicode BOMs

1.0.1(4y ago)2323.5k↓20.1%1MITPHPPHP ^7.1|^8.0CI failing

Since Sep 20Pushed 4y ago1 watchersCompare

[ Source](https://github.com/fab2s/Bom)[ Packagist](https://packagist.org/packages/fab2s/bom)[ RSS](/packages/fab2s-bom/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (2)Dependencies (1)Versions (3)Used By (1)

Bom
===

[](#bom)

[![Build Status](https://camo.githubusercontent.com/474ea8319f72166ae2241159786cf9e5442c44f8d06aa75dc6df0efe86525196/68747470733a2f2f7472617669732d63692e636f6d2f66616232732f426f6d2e7376673f6272616e63683d6d6173746572)](https://travis-ci.com/fab2s/Bom) [![Total Downloads](https://camo.githubusercontent.com/deac8eacb8c3eb06cb195d457c1d36e1f908a3d4aa07417b3fa39f0c2e00ff3f/68747470733a2f2f706f7365722e707567782e6f72672f66616232732f626f6d2f646f776e6c6f616473)](//packagist.org/packages/fab2s/bom) [![Monthly Downloads](https://camo.githubusercontent.com/12ec4f3b714b2dfdb40cd91798657f274c6283e958f5f7207c74a32be29ce517/68747470733a2f2f706f7365722e707567782e6f72672f66616232732f626f6d2f642f6d6f6e74686c79)](//packagist.org/packages/fab2s/bom) [![Latest Stable Version](https://camo.githubusercontent.com/bd923ed3e2f49a55a293004167a923178ef9346230221a0cc38a66c887cf84b4/68747470733a2f2f706f7365722e707567782e6f72672f66616232732f626f6d2f762f737461626c65)](https://packagist.org/packages/fab2s/bom) [![Scrutinizer Code Quality](https://camo.githubusercontent.com/264b20d460e6d4b50361a6ee0596727438afe3e2d15563994ce1a94c3393aa61/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f66616232732f426f6d2f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/fab2s/Bom/?branch=master) [![PRs Welcome](https://camo.githubusercontent.com/7d9ed3c8f22eceb1711573169b1390cc0b1194467340dc815205060c162b5309/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5052732d77656c636f6d652d627269676874677265656e2e7376673f7374796c653d666c6174)](http://makeapullrequest.com) [![License](https://camo.githubusercontent.com/b3afcb04b8c56bb3a9df4264ba965b01b43061a833d72b2403e5941f07be88b1/68747470733a2f2f706f7365722e707567782e6f72672f66616232732f626f6d2f6c6963656e7365)](https://packagist.org/packages/fab2s/bom)

A purely static zero dependencies [byte Order Mark](https://en.wikipedia.org/wiki/Byte_order_mark) Helper to handle unicode BOMs

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

[](#installation)

`Bom` can be installed using composer:

```
composer require "fab2s/bom"

```

`Bom` is also included in [OpinHelper](https://github.com/fab2s/OpinHelpers) which packages several bellow "Swiss Army Knife" level Helpers covering some of the most annoying aspects of php programing, such as UTF8 string manipulation, high precision Mathematics or properly locking a file

Should you need to work with php bellow 7.1, you can still use [OpinHelper](https://github.com/fab2s/OpinHelpers) `0.x`

Prerequisites
-------------

[](#prerequisites)

`Bom` has no specific dependencies

In practice
-----------

[](#in-practice)

`Bom` supports `UTF-8|16|32` BOMs in both [*Little*](https://en.wikipedia.org/wiki/Endianness#Little) and [*Big*](https://en.wikipedia.org/wiki/Endianness#Big) [Endianness](https://en.wikipedia.org/wiki/Endianness)

`Bom` is minimalistic, it only exposes five methods

```
// get Bom
$bomAtStartOfString = Bom::extract($string); // returns null when none are found

// remove eventual BOM from beging of string
$bomLessString = Bom::drop($string);

// get encoding from a supported BOM
$encoding = Bom::getBomEncoding($bom); // returns null if the BOM is not valid

// get BOM for a supported encoding
$bom = Bom::getEncodingBom($encoding); // returns null if the encoding is not supported (has no BOM)

// get the list of BOMs as an array with corresponding encodings as indexes
$boms = Bom::getBoms(); // returns an associatiove array of encodings and correesponding BOMs

foreach ($boms as $encoding => $bom) {
    // do something ...
}
```

Requirements
------------

[](#requirements)

`Bom` is tested against php 7.1, 7.2, 7.3, 7.4 and 8.0

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

[](#contributing)

Contributions are welcome, do not hesitate to open issues and submit pull requests.

License
-------

[](#license)

`Bom` is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT).

###  Health Score

36

—

LowBetter than 82% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity36

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity64

Established project with proven stability

 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 ~635 days

Total

2

Last Release

1798d ago

PHP version history (2 changes)1.0.0PHP &gt;=7.1

1.0.1PHP ^7.1|^8.0

### Community

Maintainers

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

---

Top Contributors

[![fab2s](https://avatars.githubusercontent.com/u/7323989?v=4)](https://github.com/fab2s "fab2s (6 commits)")

---

Tags

big-endianbombyte-order-marklittle-endianphputf-16utf-32utf-8phphelperutf-8utf8Simplebomutf-16utf-32Byte-order-marklittle-endianbig-endian

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/fab2s-bom/health.svg)

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

###  Alternatives

[voku/portable-utf8

Portable UTF-8 library - performance optimized (unicode) string functions for php.

52322.4M40](/packages/voku-portable-utf8)[duncan3dc/bom-string

A small PHP library to handle byte order marks (BOM)

14538.1k2](/packages/duncan3dc-bom-string)[zjkal/time-helper

一个简单快捷的PHP日期时间助手类库。 a smart PHP datetime helper library.

21128.6k1](/packages/zjkal-time-helper)[fab2s/souuid

Simple Ordered Uuid Generator in PHP

13573.2k1](/packages/fab2s-souuid)

PHPackages © 2026

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