Download the PHP package nullbio/cbor-php without Composer
On this page you can find all versions of the php package nullbio/cbor-php. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download nullbio/cbor-php
More information about nullbio/cbor-php
Files in nullbio/cbor-php
Informations about the package cbor-php
CBOR for PHP
A comprehensive PHP library for encoding and decoding CBOR (Concise Binary Object Representation) data according to RFC 8949.
Features
- ✅ Full support for all CBOR major types (0-7)
- ✅ Extensible tag system with built-in support for common tags
- ✅ Streaming decoder for efficient memory usage
- ✅ Type-safe API with modern PHP features
- ✅ Comprehensive support for indefinite-length objects
- ✅ Built-in normalization to PHP native types
Installation
Requirements:
- PHP 8.5.0
- ext-mbstring 8.5.0
- brick/math 0.14.8
Optional but recommended:
- ext-gmp or ext-bcmath for improved performance with large integers
- ext-bcmath for Big Float and Decimal Fraction support
This fork intentionally hard-pins its Composer and platform dependencies. Update them only as an explicit maintenance action.
This project follows semantic versioning strictly.
Quick Start
Documentation
📖 Complete Documentation - Full API reference and guides
Quick Links
- Tags Reference - Complete guide to all 15+ supported CBOR tags
- Creating Custom Tags - Implement your own tags for domain-specific needs
- API Reference - Encoding and decoding API
- Examples - WebAuthn, COSE, IoT, and more
Major Types Overview
This library supports all CBOR major types defined in RFC 8949:
| Major Type | Description | Classes |
|---|---|---|
| 0 | Unsigned Integer | UnsignedIntegerObject |
| 1 | Negative Integer | NegativeIntegerObject |
| 2 | Byte String | ByteStringObject, IndefiniteLengthByteStringObject |
| 3 | Text String | TextStringObject, IndefiniteLengthTextStringObject |
| 4 | Array | ListObject, IndefiniteLengthListObject |
| 5 | Map | MapObject, IndefiniteLengthMapObject |
| 6 | Tag | Tag and subclasses - See Tags Reference |
| 7 | Other | TrueObject, FalseObject, NullObject, etc. |
Common API:
- All objects have a static
create()method for instantiation - All objects can be converted to binary:
(string) $object - Many objects implement
Normalizableto convert to native PHP types
Basic Usage Examples
For complete documentation with all examples, see the Documentation.
Working with Basic Types
Working with Tags
📖 For complete tags documentation, see Tags Reference
Supported Tags:
- Date/Time (Tags 0, 1)
- Big Numbers (Tags 2, 3)
- Decimal/Binary Fractions (Tags 4, 5)
- Encoding hints (Tags 21, 22, 23)
- URIs and MIME (Tags 32, 36)
- And more...
Create your own: See Creating Custom Tags guide.
Complete Example
For more examples including WebAuthn, COSE, IoT scenarios, and advanced usage, see the complete documentation.
Contributing
Contributions are welcome! Here's how you can help:
- Report bugs and request features via GitHub Issues
- Fix issues labeled "help wanted"
- Improve documentation
- Submit pull requests
Support
Use GitHub Issues for bugs and feature requests.
License
This project is released under the MIT License.
Maintained by: nullbio and contributors