We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Config Factory: Storable configuration in Database or Files

It is very useful to have a component to create and save configurations in a database or files.

initial thought:

Table in db:

collection (varchar)   | name (varchar)     | data (BLOB)

service:

configFactory

Implement:

$siteSettings = $configFactory->get('site.settings');
$siteSettings->addData(['title' => 'Mi gran sitio']);
$siteSettings->save();

now we can Retrieve settings when we want.

What do you think is a good idea to add it to Phalcon?

edited Sep '16

Why would you need to store it in a database, when there's already a Config component?

Phalcon\Config is designed to simplify the access to, and the use of, configuration data within applications. It provides a nested object property based user interface for accessing this configuration data within application code.

Take a look at this:

Setting up PhalconPHP with Environment Variables

https://phalcon.io/setting-up-phalconphp-with-environment-variables

https://forum.phalcon.io/discussion/7781/env

I need to save and recall multiple config object according to the need. also able to generate.

Why would you need to store it in a database, when there's already a Config component?

Phalcon\Config is designed to simplify the access to, and the use of, configuration data within applications. It provides a nested object property based user interface for accessing this configuration data within application code.

Take a look at this:

Setting up PhalconPHP with Environment Variables

https://phalcon.io/setting-up-phalconphp-with-environment-variables

https://forum.phalcon.io/discussion/7781/env

This approach is useful and used in: