joetjen.net
EN DE
← All libraries
PHP

php-dextrin

DXN for PHP — .dxn text, .dxnb binary and .dxns schema documents.

Intention

The third implementation of the same format spec, next to Elixir and Node.js: a PHP service and an Elixir service can exchange .dxnb without either giving up type precision.

Example
use JOetjen\Dextrin\Dextrin;

$value = Dextrin::decode('%{x: 1, y: 2}');
// => ['x' => 1, 'y' => 2]

Dextrin::encode($value);
// => '%{x:1,y:2}'

$bytes = Dextrin::encodeBinary($value);
Dextrin::decodeBinary($bytes);   // => the same value back
Install
composer require joetjen/dextrin
PHPSerialization