{"id":22092130,"url":"https://github.com/krakphp/config","last_synced_at":"2025-03-23T23:44:58.934Z","repository":{"id":57009007,"uuid":"89897219","full_name":"krakphp/config","owner":"krakphp","description":"Efficient and Powerful Configuration","archived":false,"fork":false,"pushed_at":"2017-05-01T04:49:55.000Z","size":11,"stargazers_count":1,"open_issues_count":2,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-29T06:52:27.126Z","etag":null,"topics":["config","ini-config","json-config","php-config","yaml-configuration"],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/krakphp.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-05-01T04:27:47.000Z","updated_at":"2018-02-12T17:54:48.000Z","dependencies_parsed_at":"2022-08-21T14:50:51.210Z","dependency_job_id":null,"html_url":"https://github.com/krakphp/config","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/krakphp%2Fconfig","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/krakphp%2Fconfig/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/krakphp%2Fconfig/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/krakphp%2Fconfig/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/krakphp","download_url":"https://codeload.github.com/krakphp/config/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245186923,"owners_count":20574554,"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","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","ini-config","json-config","php-config","yaml-configuration"],"created_at":"2024-12-01T03:08:24.974Z","updated_at":"2025-03-23T23:44:58.904Z","avatar_url":"https://github.com/krakphp.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Config\n\nThe Config library provides a simple interface for adding configuration values. All config files are loaded lazily only when invoked providing a clean yet efficient way of managing config.\n\n## Installation\n\nInstall with composer at `krak/config`\n\n## Usage\n\nAll Config is managed via the ConfigStore. `Config\\store` provides a default instance which will lazy load files/data and will cache the results to prevent multiple filesystem calls.\n\n### Adding Config Items\n\nAdding multiple entries under the same key will merge the data when it's retrieved. The entries added last will overwrite the previous entries.\n\n```php\n\u003c?php\n\n$config = Krak\\Config\\store();\n// add array data\n$config-\u003eadd('a', [\n    'from_array' =\u003e true,\n    'b' =\u003e ['c' =\u003e 1]\n]);\n$config-\u003eadd('a', function() {\n    return ['from_closure' =\u003e true],\n});\n// You can add, php, ini, json, or yml files, but you must provide the full path\n$config-\u003eadd('a', __DIR__ . '/path/a.php');\n\n// or you can use this helper for files\n$config-\u003eaddFiles(__DIR__ . '/path', [\n    'a.php',\n]);\n$config-\u003eaddPhpFiles(__DIR__ . '/path', ['a']); // this is the exact same as above\n```\n\nPHP configuration files must return an array like so:\n\n```php\n\u003c?php\n\nreturn [\n    'from_php_file' =\u003e true\n];\n```\n\n**Note:** For YAML files, you must install the Symfony YAML Component (`symfony/yaml`).\n\n### Getting Config Items\n\n```php\n\u003c?php\n\nvar_dump($config-\u003eget('a'));\n\n// or retrieve nested items\n$config-\u003eget('a.b.c');\n```\n\nThis will display something like:\n\n```\narray(4) {\n  [\"from_array\"]=\u003e\n  bool(true)\n  [\"from_closure\"]=\u003e\n  bool(true)\n  [\"from_php_file\"]=\u003e\n  bool(true)\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkrakphp%2Fconfig","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkrakphp%2Fconfig","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkrakphp%2Fconfig/lists"}