Is it possible for Middleware to modify the $request object such that the each of the array items returned by getParsedBody()
can be truncated to not exceed a set length, then the $request object has the truncated body replace its original body?
Something like:
$bodyin = $request->getParsedBody();
foreach ($bodyin as $k => $v) {
$bodyin[$k] = mb_substr($v,0,100);
}
$body = new \Slim\Http\Body(fopen('php://temp', 'wb+'));
$body->write(serialize($bodyin)); // This part does not work as is
$request = $request->withBody($body);
Then the rest of the app will access the new modified $request object.