Eventsub may not trigger

You could use the header of twitch-eventsub-subscription-type as part of the file name to write to

notes(file_get_contents('php://input'));

(also no need to do php://input again when the data you need is in $raw_data already)

becomes

file_put_contents(__DIR__ . '/' . $headers['twitch-eventsub-subscription-type'] . '.log', $raw_data. "\n", FILE_APPEND);

roughly speaking.

That’ll then generate a log file for each subscription type