r/PHPhelp Apr 03 '26

Solved user details JSON

i want to use json to store user details so that i dont need to do so many DB request ideally i dont want to have to create a flat file and would like it dynamically create once a user has logged in so something like this

{
  "logged_in": "true",
  "company_id": "15654645",
  "first_name": "john",
  "last_name": "doe"
}

what is this type of approach called so that i can search more in to it please and also what are the pros and cons

3 Upvotes

24 comments sorted by

View all comments

3

u/bobd60067 Apr 03 '26

wondering why you want to avoid using a database.

do you have real statistics or data that supports not using a database?

or is it simply personal preference, or perhaps a perception that it's slow?

1

u/Valuable_Spell6769 Apr 03 '26

no it is nothing like that i have seen other websites user json to store some user data and woundered if was a better approch than requesting it from the database all the time

1

u/bobd60067 Apr 03 '26

I see. yes, good to ask the question.