How to make a file using fopen() fwrite() in slim 3

Code 200 means the response from server to the client is successfuly but not means your function is fine. You should check the error_logs for more acurate information.

I really sure if your path is not correct or maybe it is permission issues from your web server.
Because you cant write a blank file.

If php server doesn’t returns any error, you can force to die like this

// try to open file
$fp = fopen('tester.txt', 'a') or die('fopen failed');
//try to write file
fwrite($fp, "tester to write any text...") or die('fwrite failed');
//close
fclose($fp);

It’s to help determine where is the error happened