Download the PHP package inodrahq/bcs without Composer
On this page you can find all versions of the php package inodrahq/bcs. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Vendor inodrahq
Package bcs
Short Description A PHP implementation of BCS (Binary Canonical Serialization) — the serialization format used by Sui, Aptos, and other Move-based blockchains
License MIT
Homepage https://github.com/inodrahq/php-bcs
Package bcs
Short Description A PHP implementation of BCS (Binary Canonical Serialization) — the serialization format used by Sui, Aptos, and other Move-based blockchains
License MIT
Homepage https://github.com/inodrahq/php-bcs
Please rate this library. Is it a good library?
Informations about the package bcs
PHP BCS
A PHP implementation of Binary Canonical Serialization (BCS) — the serialization format used by Sui, Aptos, and other Move-based blockchains.
Requirements
- PHP 8.2+
- ext-bcmath
Installation
Quick Start
Supported Types
| BCS Type | PHP Class | Description |
|---|---|---|
bool |
Boolean |
True/false |
u8 |
U8 |
Unsigned 8-bit integer |
u16 |
U16 |
Unsigned 16-bit little-endian |
u32 |
U32 |
Unsigned 32-bit little-endian |
u64 |
U64 |
Unsigned 64-bit little-endian |
u128 |
U128 |
Unsigned 128-bit little-endian |
u256 |
U256 |
Unsigned 256-bit little-endian |
i8 |
I8 |
Signed 8-bit integer |
i16 |
I16 |
Signed 16-bit little-endian |
i32 |
I32 |
Signed 32-bit little-endian |
i64 |
I64 |
Signed 64-bit little-endian |
i128 |
I128 |
Signed 128-bit little-endian |
bytes |
Bytes |
Fixed-length byte array |
string |
BcsString |
ULEB128-prefixed UTF-8 string |
vector<T> |
Vector |
ULEB128-prefixed sequence |
option<T> |
Option |
0x00 (None) or 0x01 + value (Some) |
map<K,V> |
Map |
Sorted key-value pairs |
struct |
Struct |
Ordered named fields |
enum |
Enum |
ULEB128 variant index + data |
tuple |
Tuple |
Ordered unnamed fields |
fixed_array |
FixedArray |
Fixed-length array (no length prefix) |
byte_vector |
ByteVector |
ULEB128-prefixed raw bytes |
Advanced Usage
Structs
Enums
Options
Maps
Tuples
Fixed Arrays
Decoding
All container types require type context for decoding:
Custom Types
Implement the BcsType interface:
Hex Helpers
All encoded types support hex output via the Encoder:
Testing
228 tests verified against golden vectors generated by the Rust bcs crate.
License
MIT
All versions of bcs with dependencies
PHP Build Version
Package Version
Requires
php Version
>=8.2
ext-bcmath Version *
ext-bcmath Version *
The package inodrahq/bcs contains the following files
Loading the files please wait ...