PHPackages                             hannesvdvreken/msgpack - 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. hannesvdvreken/msgpack

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

hannesvdvreken/msgpack
======================

Msgpack implementation for PHP. It's like JSON. But fast and small.

112.6k1[1 issues](https://github.com/hannesvdvreken/msgpack/issues)1PHP

Since Jan 16Pushed 11y ago4 watchersCompare

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

READMEChangelogDependenciesVersions (1)Used By (1)

[Msgpack](http://msgpack.org/) implementation for Modern PHP
============================================================

[](#msgpack-implementation-for-modern-php)

[![Build Status](https://camo.githubusercontent.com/88506d5eabd5a7e0e22473924bdf4de2d959f8ac0b9d2b3b3fccb3aa9e6e4ad8/687474703a2f2f696d672e736869656c64732e696f2f7472617669732f68616e6e657376647672656b656e2f6d73677061636b2e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/hannesvdvreken/msgpack)[![License](https://camo.githubusercontent.com/59b8b847b252f14fbc26ca08523b2c0d8802fee0427907c511550506df4c9a55/687474703a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f68616e6e657376647672656b656e2f6d73677061636b2e7376673f7374796c653d666c61742d737175617265)](#license)

What is Msgpack?
----------------

[](#what-is-msgpack)

If you ever wished to use JSON for convenience (storing an image with metadata) but could not for technical reasons (encoding, size, speed...), MessagePack is a perfect replacement.

MessagePack is an efficient binary serialization format. It lets you exchange data among multiple languages like JSON. But it's faster and smaller. Small integers are encoded into a single byte, and typical short strings require only one extra byte in addition to the strings themselves.

For more information on Msgpack: [msgpack.org](http://msgpack.org/)

Usage
-----

[](#usage)

There are 2 main classes with each a single method to use:

```
$encoder = new Msgpack\Encoder();
$string = $encoder->encode($data);

$decoder = new Msgpack\Decoder();
$data = $decoder->decode($string);
```

Or if you prefer, you can also call the static methods with the exact same interface:

```
$string = Msgpack\Encoder::encode($data);

$decoder = Msgpack\Decoder::decode($string);
```

This is to allow you to inject the encoder and decoder into your classes so you can mock them out.

Some messages or encoded string throw exceptions because Msgpack has its limitations:

```
try {
    $string = $encoder->encode($data);
} catch (Msgpack\UnencodeableException $unencex) {
    //
}
```

```
try {
    $string = $decoder->decode($string);
} catch (Msgpack\UndecodeableException $undecex) {
    //
}
```

Testing
-------

[](#testing)

Run tests with `composer test`.

Other packages
--------------

[](#other-packages)

This is [not the first](https://packagist.org/search/?q=msgpack) packagist package on msgpack, but it is the first that is not an RPC client for the Msgpack cli tool. This package doesn't require any external non-php libraries to be installed. The [default Msgpack library](https://github.com/msgpack/msgpack-php)is a PECL library, so not so interesting to install.

License
-------

[](#license)

[MIT](license)

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance18

Infrequent updates — may be unmaintained

Popularity23

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 97.3% 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/9937cd6d2eff58e99c75bc2d4a53066e7c9cfdec457c798d5d02d37e6947f419?d=identicon)[hannesvdvreken](/maintainers/hannesvdvreken)

---

Top Contributors

[![hannesvdvreken](https://avatars.githubusercontent.com/u/1410358?v=4)](https://github.com/hannesvdvreken "hannesvdvreken (36 commits)")[![gabushev](https://avatars.githubusercontent.com/u/1582552?v=4)](https://github.com/gabushev "gabushev (1 commits)")

### Embed Badge

![Health badge](/badges/hannesvdvreken-msgpack/health.svg)

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

###  Alternatives

[mirazmac/dotenvwriter

A PHP library to write values to .env (DotEnv) files

19129.3k7](/packages/mirazmac-dotenvwriter)[joegreen0991/config

Config component based on laravel's

233.3k](/packages/joegreen0991-config)

PHPackages © 2026

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