~earboxer/bare-mess-php

PHP implementation of BARE messages.
tests: Add example values from spec
Is: Fix implementation
Int: Fix implementation

clone

read-only
https://git.sr.ht/~earboxer/bare-mess-php
read/write
git@git.sr.ht:~earboxer/bare-mess-php

You can also use your local clone with git send-email.

#Bare Mess

PHP implementation of BARE.

Work in progress.

#Support

#Primitives

BARE primitive: BareMess class name (php default type).

  • uint: UInt
  • int: Integer (int)
  • u8, u16, u32, u64: U8, U16, U32, U64
  • i8, i16, i32, i64: I8, I16, I32, I64
  • f32, f64: Not yet implemented.
  • bool: Boolean (bool)
  • enum: extend Uint, defining constants. (e.g. example/Department.php)
  • string: Str (string)
  • data<length>: extend Data, defining BYTES. (e.g. example/PublicKey.php)
  • data: Str
  • void: Nothing

All primitive types provide the following methods, which can be used as follows.

use BareMess\U16;

$dayNumber = U16::fromValue(366); // Create object with specific value.
$dayNumber->set(365); // Mutator
$mess = $dayNumber->mess(); // Convert into BARE message format.
$day = new U16($mess); // Constructor mutates the $mess parameter
$day->get(); // Accessor -- returns 365
class Data2 extends \BareMess\Data {public const BYTES = 2;}
$mess = $day->mess();
$data2 = new Data2($mess);
$data2->get(); // Will be equivalent to $day->mess().

#Aggregates

  • optional<type>: Not completely implemented.
  • [length]type: Not yet implemented.
  • []type: Not completely implemented.
  • map[type A]type B: Not completely implemented.
  • (type | type | ...): Not yet implemented.
  • struct: WIP, extend Struct. (e.g. example/Employee.php)