PHPackages                             lemonblast/cbor4php - 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. lemonblast/cbor4php

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

lemonblast/cbor4php
===================

CBOR encoder/decoder for PHP

1.0.0(11y ago)3158.9k↑84.8%2[1 issues](https://github.com/Lemonblast/Cbor4Php/issues)MITPHPPHP &gt;=5.4.0

Since Jan 22Pushed 11y agoCompare

[ Source](https://github.com/Lemonblast/Cbor4Php)[ Packagist](https://packagist.org/packages/lemonblast/cbor4php)[ Docs](https://github.com/lemonblast/cbor4php)[ RSS](/packages/lemonblast-cbor4php/feed)WikiDiscussions master Synced 1mo ago

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

Cbor4Php
========

[](#cbor4php)

[CBOR](http://cbor.io/) (Concise Binary Object Representation) is a tiny data format that can be used in place of JSON. Cbor4Php is a simple CBOR encoder/decoder for PHP.

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

[](#installation)

To install the library through composer, you simply need to add the following to `composer.json` and run `composer update` or `composer install`:

```
{
    "require": {
       "lemonblast/cbor4php": "dev-master"
    }
}
```

Once installed, you can use the Cbor class (`Lemonblast\Cbor4Php\Cbor`) to encode and decode CBOR data.

Usage
-----

[](#usage)

Include the Cbor4Php library in your source:

```
use Lemonblast\Cbor4Php\Cbor;
```

#### Encoding

[](#encoding)

To encode a variable into a CBOR byte string call the encode method and pass the value as a parameter:

```
$foo = Cbor::encode($bar);
```

Encoding an object will convert it to an associative array, and encode it as such. Only public fields will be encoded.

Encoding a PHP resource is not supported and will result in a null return value.

#### Decoding

[](#decoding)

To decode a CBOR byte string into a PHP variable:

```
$bar = Cbor::decode($foo);
```

CBOR data tags are ignored during the decode process. Decoding a null value or empty string will result in a null return value.

Testing
-------

[](#testing)

To run unit tests, simply clone this repository and run `composer install` followed by `php vendor/bin/phpunit` in the project directory.

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance13

Infrequent updates — may be unmaintained

Popularity39

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor1

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

4135d ago

### Community

Maintainers

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

---

Top Contributors

[![lrezek](https://avatars.githubusercontent.com/u/6645422?v=4)](https://github.com/lrezek "lrezek (135 commits)")[![aweebs](https://avatars.githubusercontent.com/u/8809837?v=4)](https://github.com/aweebs "aweebs (51 commits)")

---

Tags

phpcbor

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/lemonblast-cbor4php/health.svg)

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

###  Alternatives

[nikic/phlexy

Lexing experiments in PHP

162570.9k13](/packages/nikic-phlexy)[corveda/php-sandbox

A PHP library that can be used to run PHP code in a sandboxed environment

23483.5k2](/packages/corveda-php-sandbox)[blancks/fast-jsonpatch-php

Class designed to efficiently handle JSON Patch operations in accordance with the RFC 6902 specification

396.4k](/packages/blancks-fast-jsonpatch-php)[bupy7/xml-constructor

The array-like constructor of XML document structure.

1337.9k](/packages/bupy7-xml-constructor)

PHPackages © 2026

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