I'm creating a web app using PHP (Symfony2 framework) and I want to store some data that's created by the user, but I don't want to use a database. I think the best way to do this is JSON objects. Please look at my descriptions below and provide feedback on if this is a good way or bad way, or if it's even possible.
Front-end: user customizes the page, adding content and such (text, numbers, etc). Upon making any changes to the page, a front-end JS save function forms a JSON object, sends it to a php controller, then saves it into the
user.json
file.Back-end: In addition to saving, the controller will scan the
user.json
file for any objects with the same id as the new one being saved. If it exists, it will delete that object, then add in the new updated object.
Q1 Is it best to delete the old object 12345 and re-add the updated 12345? Or would it be better to simply update the object somehow?
Q2 Is this way of storing data a good way and is it possible/easy in PHP?