jhartell / hexdump
Hexdump utility for PHP
Installs: 31
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/jhartell/hexdump
Requires
- php: >=5.3.0
Requires (Dev)
- phpunit/phpunit: 4.1.*
This package is not auto-updated.
Last update: 2025-10-12 00:57:37 UTC
README
jhartell/hexdump
Hexdump utility for PHP. Print binary data in a similar format to the hexdump (hd) command line tool. Useful when debugging socket communications or handling binary files.
Installation
Install the latest version with
$ composer require jhartell/hexdump
Usage
<?php use Jhartell\Hexdump\Hexdump; $hexdump = new Hexdump(); $data = "This is a string with non-printable \x05\x10 characters\x00"; ?> <pre> <?php echo $hexdump->dump($data); ?> </pre>
This will output the data in the default Hex+ASCII format.
00000000 54 68 69 73 20 69 73 20 61 20 73 74 72 69 6e 67 |This is a string|
00000010 20 77 69 74 68 20 6e 6f 6e 2d 70 72 69 6e 74 61 | with non-printa|
00000020 62 6c 65 20 05 10 20 63 68 61 72 61 63 74 65 72 |ble .. character|
00000030 73 00 |s.|
00000032