M
M
My joy2018-02-07 11:35:16
Yii
My joy, 2018-02-07 11:35:16

What is the best way to get the application config from the database?

Hello friends!
There is a need to store the application config (settings: param, value)in the database so that it can be easily accessed from the UI.
I want to receive it like this: $settings = AppSettings::get();
Question: where in the application should I receive this config so that it is always available from anywhere in the application? Is there a class autoload for this? So that you can use it later, $settings->sitenameetc.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
Maxim Fedorov, 2018-02-07
@t-alexashka

You can simply make a config of the application components and already work with it any way and anywhere

D
Dmitry, 2018-02-07
@slo_nik

Good morning.
There is an article that describes what you need. True, it is under yii1, but it will not be difficult to remake the code for yii2.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question