PHPackages                             longitude-one/wkb-parser - 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. [Parsing &amp; Serialization](/categories/parsing)
4. /
5. longitude-one/wkb-parser

ActiveLibrary[Parsing &amp; Serialization](/categories/parsing)

longitude-one/wkb-parser
========================

Parser for well-known binary (WKB/EWKB) object data

3.0.1(1w ago)4719.7k↓35.9%11MITPHPPHP ^8.1CI passing

Since Apr 5Pushed 1w ago1 watchersCompare

[ Source](https://github.com/longitude-one/wkb-parser)[ Packagist](https://packagist.org/packages/longitude-one/wkb-parser)[ RSS](/packages/longitude-one-wkb-parser/feed)WikiDiscussions main Synced 2d ago

READMEChangelog (7)Dependencies (2)Versions (9)Used By (1)

longitude-one/wkb-parser
========================

[](#longitude-onewkb-parser)

[![longitude-one/wkb-parser](https://camo.githubusercontent.com/e140bb4ec0f17cf566b67342360100393598417007b71f62e2b27a4d55c120bf/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6f6e6769747564652d2d6f6e652d776b622d2d7061727365722d626c7565)](https://camo.githubusercontent.com/e140bb4ec0f17cf566b67342360100393598417007b71f62e2b27a4d55c120bf/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6f6e6769747564652d2d6f6e652d776b622d2d7061727365722d626c7565)[![Stable release](https://camo.githubusercontent.com/e213290083ff374ac03e4ba8ad1b36cdf3e6754ee6165bab1b479d84123306a5/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f72656c656173652f6c6f6e6769747564652d6f6e652f776b622d706172736572)](https://camo.githubusercontent.com/e213290083ff374ac03e4ba8ad1b36cdf3e6754ee6165bab1b479d84123306a5/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f72656c656173652f6c6f6e6769747564652d6f6e652f776b622d706172736572)[![Packagist License](https://camo.githubusercontent.com/c8eb3fe83ce314d0742979a8c2b32629cf1d3d09859dd11a7f5eee827ee091bd/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6c6f6e6769747564652d6f6e652f776b622d706172736572)](https://github.com/longitude-one/wkb-parser/blob/main/LICENSE)

Parser library for 2D, 3D, and 4D Open Geospatial Consortium (OGC) WKB or PostGIS EWKB spatial object data.

[![PHP CI](https://github.com/longitude-one/wkb-parser/actions/workflows/ci.yml/badge.svg)](https://github.com/longitude-one/wkb-parser/actions/workflows/ci.yml)[![Maintainability](https://camo.githubusercontent.com/343ff2315f52527832e104f551ea0533dfb7022948a2ade0612e85bc7a1d30ae/68747470733a2f2f6170692e636f6465636c696d6174652e636f6d2f76312f6261646765732f66666561663164343935313339373930346133332f6d61696e7461696e6162696c697479)](https://codeclimate.com/github/longitude-one/wkb-parser/maintainability)[![Test Coverage](https://camo.githubusercontent.com/e18b8950d3abb1dbcd82d18b14c663c1a9fee6e0e2a9ed216abeef9f68dcd1b8/68747470733a2f2f6170692e636f6465636c696d6174652e636f6d2f76312f6261646765732f66666561663164343935313339373930346133332f746573745f636f766572616765)](https://codeclimate.com/github/longitude-one/wkb-parser/test_coverage)[![Minimum PHP Version](https://camo.githubusercontent.com/2e2c3f3fe823070e68978a6b08842b93df1161a490c1a60d3bd1a818b517227e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f6c6f6e6769747564652d6f6e652f776b622d7061727365722e7376673f6d61784167653d33363030)](https://camo.githubusercontent.com/2e2c3f3fe823070e68978a6b08842b93df1161a490c1a60d3bd1a818b517227e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f6c6f6e6769747564652d6f6e652f776b622d7061727365722e7376673f6d61784167653d33363030)

[![CI](https://github.com/longitude-one/wkb-parser/actions/workflows/ci.yml/badge.svg)](https://github.com/longitude-one/wkb-parser/actions/workflows/ci.yml)[![Downloads](https://camo.githubusercontent.com/a2e557d09f8aabcce13eb6e1ef08526bf28dcb7995eebc9208c23dff80c10043/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646d2f6c6f6e6769747564652d6f6e652f776b622d7061727365722e737667)](https://packagist.org/packages/longitude-one/wkb-parser)

Note

This package is the continuation of the now abandoned [creof/wkt-parser](https://github.com/creof/wkb-parser) package.

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

[](#installation)

```
composer require longitude-one/wkb-parser
```

Usage
-----

[](#usage)

There are two use patterns for the parser. The value to be parsed can be passed into the constructor, then parse() called on the returned `Parser` object:

```
$parser = new Parser($input);

$value = $parser->parse();
```

If many values need to be parsed, a single `Parser` instance can be used:

```
$parser = new Parser();

$value1 = $parser->parse($input1);
$value2 = $parser->parse($input2);
```

### Input value

[](#input-value)

#### Encoding

[](#encoding)

The parser currently supports 3 WKB encodings:

- OGC v1.1
- OGC v1.2
- PostGIS EWKB

#### Format

[](#format)

The parser supports a number of input formats:

- Binary string (as returned from database or `pack('H*', $hexString)`)
- Bare hexadecimal text string (`'01010000003D0AD7A3.....'`)
- Hexadecimal test string prepended with `x`, `X`, `0x`, or `0X` (`'0x01010000003D0AD7A3.....'`, etc.)

Return
------

[](#return)

The parser will return an array with the keys `type`, `value`, `srid`, and `dimension`.

- `type` string, the uppercase spatial object type (`POINT`, `LINESTRING`, etc.) without any dimension.
- `value` array, contains integer or float values for points, nested arrays containing these based on spatial object type, or empty array for EMPTY geometry.
- `srid` integer, the SRID if present in EWKB value, `null` otherwise.
- `dimension` string, will contain `Z`, `M`, or `ZM` for the respective 3D and 4D objects, `null` otherwise.

Exceptions
----------

[](#exceptions)

The `Reader` and `Parser` will throw exceptions implementing interface `CrEOF\Geo\WKB\Exception\ExceptionInterface`.

References
----------

[](#references)

- PostGIS EWKB -
- OGC Simple Feature Access, Part 1 -
- OGC Simple Feature Access, Part 2 -

###  Health Score

56

—

FairBetter than 97% of packages

Maintenance98

Actively maintained with recent releases

Popularity43

Moderate usage in the ecosystem

Community15

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 79.5% 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 ~135 days

Recently: every ~201 days

Total

7

Last Release

9d ago

Major Versions

1.0.0 → 2.0.02024-04-08

2.1.0 → 3.0.02024-04-10

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/5101481?v=4)[Alexandre Tranchant](/maintainers/Alexandre-T)[@Alexandre-T](https://github.com/Alexandre-T)

---

Top Contributors

[![djlambert](https://avatars.githubusercontent.com/u/1187338?v=4)](https://github.com/djlambert "djlambert (140 commits)")[![Alexandre-T](https://avatars.githubusercontent.com/u/5101481?v=4)](https://github.com/Alexandre-T "Alexandre-T (34 commits)")[![emenkens](https://avatars.githubusercontent.com/u/2665860?v=4)](https://github.com/emenkens "emenkens (1 commits)")[![sadortun](https://avatars.githubusercontent.com/u/794449?v=4)](https://github.com/sadortun "sadortun (1 commits)")

---

Tags

stringparsertextgeometrygeographyspatialwkbewkb

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/longitude-one-wkb-parser/health.svg)

```
[![Health](https://phpackages.com/badges/longitude-one-wkb-parser/health.svg)](https://phpackages.com/packages/longitude-one-wkb-parser)
```

###  Alternatives

[creof/wkb-parser

Parser for well-known binary (WKB/EWKB) object data

605.3M15](/packages/creof-wkb-parser)[creof/geo-parser

Parser for geography coordinate strings

624.6M14](/packages/creof-geo-parser)[creof/wkt-parser

Parser for well-known text (WKT) object strings

545.0M15](/packages/creof-wkt-parser)[geo-io/wkb-parser

Well-known binary (WKB) Parser.

786.3M53](/packages/geo-io-wkb-parser)[fanatique/php-fixed-length-file-parser

A parser class for handling fixed length text files in PHP

159.6k](/packages/fanatique-php-fixed-length-file-parser)[laurentvw/scrapher

A web scraper for PHP to easily extract data from web pages

202.5k1](/packages/laurentvw-scrapher)

PHPackages © 2026

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