Thread safe file write & read
FileSream is class that will enable thread safe file write & read. I am not the author of the the class, I just made some changes and change the protocol to panx://. The license is on the end of this page.
The usage is easy, just add to filepath the panx:// protocol.
file_put_contents("panx://text.txt", "Hello world!");