How should I store settings for project?
Which is better - to use a $settings
array with all my settings:
$settings['max_photos'] = 30;
//...
or create a singleton Config
class with all the settings in it?
Class Config {
private $max_photos = 30;
//...
}
Any good examples?
I tend to put configuration values that are only accessed globally in a config array and define values that are accessed anywhere. For example:
inc/config.php
inc/init.php
somefile.php
Keep in mind this example is stripped down to demonstrate an idea.