{"id":14985696,"url":"https://github.com/webiny/config","last_synced_at":"2025-10-08T07:08:19.759Z","repository":{"id":20205130,"uuid":"23476561","full_name":"webiny/Config","owner":"webiny","description":"[READ-ONLY] PHP `Config` component creates `ConfigObject` instances from config files. Currently supported formats: INI, JSON, PHP, YAML and custom drivers.  (master at Webiny/Framework)","archived":false,"fork":false,"pushed_at":"2017-11-26T21:24:27.000Z","size":44,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-04-11T22:06:33.965Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://www.webiny.com/","language":"PHP","has_issues":false,"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/webiny.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":"2014-08-29T20:16:44.000Z","updated_at":"2023-05-21T17:35:08.000Z","dependencies_parsed_at":"2022-08-30T20:11:39.864Z","dependency_job_id":null,"html_url":"https://github.com/webiny/Config","commit_stats":null,"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webiny%2FConfig","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webiny%2FConfig/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webiny%2FConfig/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/webiny%2FConfig/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/webiny","download_url":"https://codeload.github.com/webiny/Config/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248487716,"owners_count":21112191,"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":[],"created_at":"2024-09-24T14:11:30.176Z","updated_at":"2025-10-08T07:08:14.737Z","avatar_url":"https://github.com/webiny.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"Config Component\n=====================\n`Config` component creates `ConfigObject` instances from config files.\nCurrently supported formats: INI, JSON, PHP, YAML and custom drivers.\n\nInstall the component\n---------------------\nThe best way to install the component is using Composer.\n\n```bash\ncomposer require webiny/config\n```\nFor additional versions of the package, visit the [Packagist page](https://packagist.org/packages/webiny/config).\n\n## Usage\n\nTo use `Config` component you will need a config file.\n\nExample INI:\n\n    [properties]\n    a = \"value\"\n    b.name = \"name\"\n    b.value = \"value\"\n\nHere is an example of creating a `ConfigObject`:\n```php\n    $config = \\Webiny\\Components\\Config\\Config::getInstance()-\u003eini('path/to/file.ini');\n```\n\nThis will result in $config object containing the following properties:\n\n```php\n    $config-\u003eproperties-\u003ea = 'value';\n    $config-\u003eproperties-\u003eb-\u003ename = 'name';\n    $config-\u003eproperties-\u003eb-\u003evalue = 'value';\n```\n\nIf you don't want to use INI sections, or set custom nest delimiter, specify the following arguments:\n```php\n    $config = \\Webiny\\Components\\Config\\Config::getInstance()-\u003eini('path/to/file.ini', false, '_');\n```\n\nYou can get your config as string in any format using the following methods:\n```php\n    $string = $config-\u003egetAsJson();\n    $string = $config-\u003egetAsPhp();\n    $string = $config-\u003egetAsIni($useSections = true, $nestDelimiter = '.');\n    $string = $config-\u003egetAsYaml($indent = 4);\n```\nAnd you can also use custom driver\n\n```php\n    $driverInstance = new MyCustomDriver();\n    $string = $config-\u003egetAs($driverInstance);\n```\n\nYou can also merge one config with another `ConfigObject` or array:\n```php\n$config-\u003emergeWith($config2);\n```\n\nResources\n---------\n\nTo run unit tests, you need to use the following command:\n\n    $ cd path/to/Webiny/Component/Config/\n    $ composer.phar install\n    $ phpunit\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwebiny%2Fconfig","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwebiny%2Fconfig","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwebiny%2Fconfig/lists"}