In php 8.4, this can now be achieved with the request_parse_body
function
https://www.php.net/manual/en/function.request-parse-body.php
<?php
if($_SERVER['REQUEST_METHOD'] === 'PUT' || $_SERVER['REQUEST_METHOD'] === 'PATCH') {
[$_POST, $_FILES] = request_parse_body();
}