{"id":28490520,"url":"https://github.com/alexdodonov/mezon-conf","last_synced_at":"2025-08-27T02:21:05.044Z","repository":{"id":62527583,"uuid":"241185187","full_name":"alexdodonov/mezon-conf","owner":"alexdodonov","description":"Config routine","archived":false,"fork":false,"pushed_at":"2023-03-02T06:05:15.000Z","size":71,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-08-08T04:31:36.944Z","etag":null,"topics":["config","configuration","configuration-files","configuration-management","ini","ini-config","ini-parser","ini-reader","json-config","json-configuration","php"],"latest_commit_sha":null,"homepage":"https://twitter.com/mezonphp","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/alexdodonov.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2020-02-17T19:02:45.000Z","updated_at":"2023-12-08T22:27:22.000Z","dependencies_parsed_at":"2023-09-26T03:30:52.806Z","dependency_job_id":"5e95ce69-8627-4a26-9dc6-31fc7258ff30","html_url":"https://github.com/alexdodonov/mezon-conf","commit_stats":{"total_commits":25,"total_committers":1,"mean_commits":25.0,"dds":0.0,"last_synced_commit":"c05d62b21fc52d8583c2fb8502a23ad3517bf82a"},"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"purl":"pkg:github/alexdodonov/mezon-conf","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexdodonov%2Fmezon-conf","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexdodonov%2Fmezon-conf/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexdodonov%2Fmezon-conf/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexdodonov%2Fmezon-conf/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alexdodonov","download_url":"https://codeload.github.com/alexdodonov/mezon-conf/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexdodonov%2Fmezon-conf/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269654330,"owners_count":24454321,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-09T02:00:10.424Z","response_time":111,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["config","configuration","configuration-files","configuration-management","ini","ini-config","ini-parser","ini-reader","json-config","json-configuration","php"],"created_at":"2025-06-08T07:09:18.591Z","updated_at":"2025-08-09T23:44:57.095Z","avatar_url":"https://github.com/alexdodonov.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Conf [![Build Status](https://travis-ci.com/alexdodonov/mezon-conf.svg?branch=master)](https://travis-ci.com/alexdodonov/mezon-conf) [![codecov](https://codecov.io/gh/alexdodonov/mezon-conf/branch/master/graph/badge.svg)](https://codecov.io/gh/alexdodonov/mezon-conf)\n\n# Configuration\nMezon has it's own routine for working with configs. It can be accesed with a set of functions, wich are described below.\n\nGetting access to the key in config can be done with Conf::getValue($route, $defaultValue = false) function. It returns config value with route $route and return $defaultValue if this key was not found. For example:\n\n```PHP\n$value = Conf::getValue('res/images/favicon', 'http://yoursite.com/res/images/favicon.ico');\n```\n\nSetting values for the config key can be done by calling Conf::setConfigValue($route, $value) or Conf::addConfigValue($route, $value) function. The main difference between these two functions is that the first one sets scalar key, and the second one adds element to the array in config. Here is small example:\n\n```PHP\nConf::setConfigValue('res/value', 'Value!');\nvar_dump(Conf::getValue('res/value')); // displays 'Value!' string\n\nConf::addConfigValue('res/value', 'Value 1!');\nConf::addConfigValue('res/value', 'Value 2!');\nvar_dump(Conf::getValue('res/value')); // displays array( [0] =\u003e 'Value 1!' , [1] =\u003e 'Value 2!' )\n```\n\nYou also can use typed versions of these methods:\n\n```php\nConf::getValueAsArray(...);\nConf::getValueAsObject(...);\nConf::getValueAsString(...);\n\nConf::setConfigArrayValue(...);\nConf::setConfigObjectValue(...);\nConf::setConfigStringValue(...);\n```\n\nYou can set multyple values to the config:\n\n```php\n// here $settings is an associative array\nConf::setConfigValues(array $settings);\n```\n\nOr you can read config from JSON:\n\n```php\nConf::loadConfigFromJson(string $pathToConfig);\n```\n\nIf you are not shure that the key exists, then you can check it:\n\n```PHP\nConf::setConfigValue('res/value', 'Value!');\n\nvar_dump(Conf::configKeyExists('res')); // true\nvar_dump(Conf::configKeyExists('res2')); // false\nvar_dump(Conf::configKeyExists('res/value')); // true\n```\n\nYou can also able to delete config key\n\n```PHP\nConf::setConfigValue('res/value', 'Value!');\nConf::deleteConfigValue('res/value');\nvar_dump(Conf::configKeyExists('res/value')); // false\nvar_dump(Conf::configKeyExists('res')); // also false\n```\n\nOr clear the entire config:\n\n```php\nConf::clear();\n```\n\nThat's all you need to know about config read/write.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falexdodonov%2Fmezon-conf","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falexdodonov%2Fmezon-conf","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falexdodonov%2Fmezon-conf/lists"}