"How to send a magic packet in $LANG" isn't very interesting to me. There are plenty of guides for it, and I remember actually doing it 20+ years ago with a short PHP script.
Even at the time, the task didn't seem like "enough" for a show-the-world blog post. A dramatically shortened version (no validation, error handling, logging, etc.) for your amusement:
// Given $macAddress and $addr and $port
$macAddress = str_replace(":","",$macAddress);
$macAddress = str_replace("-","",$macAddress);
$header = pack('H12','FFFFFFFFFFFF');
$payload = pack("H12",$macAddress);
$packet = $header . str_repeat($payload,16);
$sock = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP);
socket_set_option($sock, 1, 6, TRUE);
socket_sendto($sock, $payload, strlen($payload), 0, $addr, $port);
socket_close($sock);