Should a PHP app store configuration data in defined constants or a database? -


i'm working on php application , keep going back-and-forth myself on best way store configuration data (the type might change occasionally, not frequently). includes lot of non-sensitive information validity periods tokens , cookies, or parameters various email messages application sends, includes few more sensitive things api keys.

  1. store in database table - path started going down, in part because imagining handy administrative utility allow system admins modify these values when necessary. since of application pages need access 1 or more of these values, feels lot of excess trips database, if small, fast lookups.

  2. use defined constants - thought of using defined constants , sticking data in .php file (outside web root, of course). avoid database lookups, somehow feels wasteful define few dozen constants on every page load when given page need handful of them @ most.

is 1 or other (or else altogether) recommended, whether reasons of security, efficiency, or style?

i have seen larger systems both.

store values in database can administered, while maintaining php file of constants generated each time value changed in backend.

if worried excess trips database, route go down.


Comments

Popular posts from this blog

ios - UICollectionView Self Sizing Cells with Auto Layout -

node.js - ldapjs - write after end error -

DOM Manipulation in Wordpress (and elsewhere) using php -