The technique from the answer you linked will work for your situation too, you just need to translate it into PHP and the Firebase REST APIs. Additionally, since the REST API isn't real-time you must add some kind of task queue that it can poll.
Your program would flow something like this:
- User logs in to Firebase with Simple Login
- User write to only a place that they can (based on security rules). The user also writes an entry into a task queue.
- Your PHP server connects with a token that allows reads of all of the user's secret places.
- Your PHP server polls the firebase every once in awhile to look for new tasks. If there's a new task, it validates the user and allows that user to post data to it.
All that being said, this is going to be pretty complicated. PHP's execution model does not lend itself well to real-time systems, and
I strongly recommend you consider some other options:
- You're using a cloud platform, Firebase, for your realtime stuff, so consider a cloud service for your binaries too, like filepicker.io
- If you really want to host the files yourself, use something that's more real-time like node.js. It'll save you the effort of constructing that task queue.