Download the PHP package socialdept/atp-cbor without Composer
On this page you can find all versions of the php package socialdept/atp-cbor. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download socialdept/atp-cbor
More information about socialdept/atp-cbor
Files in socialdept/atp-cbor
Package atp-cbor
Short Description CBOR, CAR, and CID binary encoding for AT Protocol in PHP
License MIT
Homepage https://github.com/socialdept/atp-cbor
Informations about the package atp-cbor
CBOR, CAR, and CID binary encoding for AT Protocol in PHP.
What is ATP CBOR?
ATP CBOR is a standalone PHP library for decoding CBOR (Concise Binary Object Representation), CAR (Content Addressable aRchive), and CID (Content Identifier) binary data from the AT Protocol network. It powers the binary decoding layer used by firehose consumers and repository loaders across the Social Dept. AT Protocol packages.
No Laravel dependency required — this is a pure PHP package.
Quick Example
Installation
Requires the gmp PHP extension for large integer handling.
Usage
Decoding CBOR
The CBOR facade provides three methods for decoding binary CBOR data:
Supports all CBOR major types including unsigned/negative integers, byte strings, text strings, arrays, maps, tagged values (including DAG-CBOR tag 42 for CID links), and special values (booleans, null, floats).
Parsing CAR Archives
CAR (Content Addressable aRchive) files contain blocks of CBOR data indexed by CID:
For memory-efficient processing, use the BlockReader generator directly:
Working with CIDs
Content Identifiers can be parsed from strings or binary data:
Low-level Binary Reading
For custom binary parsing, use the Reader and Varint utilities:
API Reference
Core Facades
| Class | Method | Description |
|---|---|---|
CBOR |
decode(string $data) |
Decode complete CBOR data |
CBOR |
decodeFirst(string $data) |
Decode first item, return remaining |
CBOR |
decodeAll(string $data) |
Decode all sequential items |
CAR |
blockMap(string $data, ?string $did) |
Parse CAR into CID => block map |
Value Objects
| Class | Description |
|---|---|
CID |
Immutable Content Identifier (v0 and v1) |
Readers
| Class | Description |
|---|---|
BlockReader |
Generator-based CAR block reader |
RecordExtractor |
AT Protocol MST record walker |
Decoder |
RFC 8949 CBOR decoder with DAG-CBOR |
Reader |
Stream-style binary data reader |
Varint |
Variable-length integer decoder |
Supported Standards
- CBOR - RFC 8949 (Concise Binary Object Representation)
- DAG-CBOR - IPLD extension with tag 42 for CID links
- CAR - Content Addressable aRchive (v1)
- CID - IPLD Content Identifiers (v0 and v1)
- Multihash - SHA-256 and other hash types
- Varint - Protocol Buffers-style variable-length integers
Requirements
- PHP 8.2+
- ext-gmp
Resources
Support & Contributing
Found a bug or have a feature request? Open an issue.
Want to contribute? We'd love your help! Check out the contribution guidelines.
Credits
- Miguel Batres - founder & lead maintainer
- All contributors
License
ATP CBOR is open-source software licensed under the MIT license.
Built for the Atmosphere • By Social Dept.