I want to create the config file dynamically as in runtime. I have a table named Settings
in a database. Its structure is like:
|Column |Type |Length|
|id |int |11 |
|key |varchar |100 |
|value |varchar |255 |
|created_at |datetime| |
|updated_at |datetime| |
Now when the application starts for the first time, it should check whether it is connected to a database or not. If not, then it should be redirected to the installer
page. Where the user will enter the necessary details and the config file will be generated accordingly and the same data will be stored in the Settings
table for future use.
I don't want to hardcode any values into the config file. So, how can I achieve this task? Any ideas?
I have thought of an idea. What if I check the params-local.php
file for a param called installed
with a value true
. If it exists, we say that the application has been installed successfully else we take the user to the installer
page.