php - Best way to store app settings that are configurable from administrator interface?

955

In the admin interface of my application, the administrators can change global application settings that effect every user of the application.

But what is the best way to store/read those settings.

  • Is writing a config yaml file from php a solution? (And how about caching?)
  • Is storing it in a database (MongoDB) the best way to go? (Every request a query? Or serialize on login?)
  • Is there a bundle especially for this? (Couldn't find one)
166

Answer

Solution:

There'sCraueConfigBundle that adds a controller and a service giving access to a list of settings. It seems like it's tightly coupled to Doctrine ORM though: https://github.com/craue/CraueConfigBundle

158

Answer

Solution:

IMHO, you have two options, 1) store it in file (i think better to store this in parameters.yml, than config files); But in this case, after each settings change, you'll need to clean cache;

2) store it in DB. If you'll have any performance issues using doctrine, you always have possibility to update getter/setter to cache results in memcache for example.

p.s. Both ways have own pluses. I prefer to split applications settings from its configuration options. So if admin wants to change global app settings, maybe it's ok to edit parametes.yml ?

People are also looking for solutions to the problem: php - Get Click event on blank part of stage

Source

Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.