thesis / endian
Library for encoding and decoding numbers in either big-endian or little-endian order.
Fund package maintenance!
www.tinkoff.ru/cf/5MqZQas2dk7
Installs: 16 411
Dependents: 4
Suggesters: 0
Security: 0
Stars: 1
Watchers: 2
Forks: 0
pkg:composer/thesis/endian
Requires
- php: ^8.3
Requires (Dev)
- bamarni/composer-bin-plugin: ^1.8.2
- ergebnis/composer-normalize: ^2.45.0
- phpunit/phpunit: ^10.5.40
This package is auto-updated.
Last update: 2025-10-31 00:32:42 UTC
README
Installation
composer require thesis/endian
Read/write in any byte order:
- In
network(big endian) byte order.
<?php declare(strict_types=1); require_once __DIR__.'/vendor/autoload.php'; use Thesis\Endian\endian; echo endian::network->unpackInt32( endian::network->packInt32(-200), ); // -200
- In
big endianbyte order.
<?php declare(strict_types=1); require_once __DIR__.'/vendor/autoload.php'; use Thesis\Endian\endian; echo endian::big->unpackInt8( endian::big->packInt8(17), ); // 17
- In
little endianbyte order.
<?php declare(strict_types=1); require_once __DIR__.'/vendor/autoload.php'; use Thesis\Endian\endian; echo endian::little->unpackFloat( endian::little->packFloat(2.2), ); // 2.2
- In
native endianbyte order.
<?php declare(strict_types=1); require_once __DIR__.'/vendor/autoload.php'; use Thesis\Endian\endian; echo endian::native->unpackInt64( endian::native->packInt64(\PHP_INT_MAX), ); // 9223372036854775807
Supported types:
-
int8 -
uint8 -
int16 -
uint16 -
int32 -
uint32 -
int64 -
uint64 -
float -
double