tgrj/tweb_config

minimalistic config system

Maintainers

Package info

codeberg.org/tgrj/tweb_config

pkg:composer/tgrj/tweb_config

Statistics

Installs: 56

Dependents: 8

Suggesters: 0

v1.0.0 2026-03-12 22:50 UTC

This package is auto-updated.

Last update: 2026-03-12 22:50:24 UTC


README

minimalistic config system

About

This is part of the core of my tweb micro framework. It serves as the config for certain other aspects of the modules / package.

Usage

  • tweb_config_get(string $key)
    • This will get the config value of the given key. This key can be some better readable array-depth like for [ 'a' => [ 'aa' => 1, 'ab' => 2 ] ] you could use 'a.ab' as a key to get the config value 2. There is a default config (tweb.conf.php) in the modules src folder, By default you can create config/tweb.conf.php relative from the project path. It should return an array. This is able to overwrite the default values, but you can also have your own config keys and values. By overwriting the global variables $TWEB_CONFIG_PATH and $TWEB_CONFIG_FILE you can define in which folder the user config is stored. You should change these values before calling tweb_config() for the first time.
  • tweb_config_set(string $key, mixed $value)
    • Normally not to use during runtime, but tests only. But maybe there are situations where you want to alter the config during runtime. The config won't be saved, though.

By default the path getcwd() . '/src/config/tweb.conf.php' is searched for user conf overwrites. You could overwrite it during runtime with tweb_config_set() ... eh, so maybe this function can be usefull during runtime, I guess. Just use it like you want. Hope this will help.