Intro
Well, you don't send an "ArrayBuffer". What you send is data and specify a format to make sense of that data. The client, then, can choose the best way to interpret it.
So, an ArrayBuffer is just a generic fixed-length container for data (binary data) that enables you to create "views" of the underlying data using JavaScript typed arrays. The cool thing is that multiple views can be created from a single ArrayBuffer source.
That being said, in your specific case, you can send binary data in PHP the same way you send any data in PHP.
Example:
server.php
$filename = 'img.png';
$fsize = filesize($filename);
$handle = fopen($filename, "rb");
$contents = fread($handle, $fsize);
fclose($handle);
header('content-type: image/png');
header('Content-Length: ' . $fsize);
echo $contents;
or shorter
$filename = 'img.png';
header('content-type: image/png');
header('Content-Length: ' . filesize($filename));
readfile($filename);
client.js
var xhr = new XMLHttpRequest();
xhr.open('GET', 'server.php', true);
xhr.responseType = 'arraybuffer';
xhr.onload = function(e) {
var uInt8Array = new Uint8Array(this.response);
console.log(uInt8Array);
};
xhr.send();