{"id":20187956,"url":"https://github.com/commonphp/config","last_synced_at":"2025-10-15T03:49:12.833Z","repository":{"id":223021977,"uuid":"758774715","full_name":"commonphp/config","owner":"commonphp","description":"Library designed to simplify the management of configuration files in PHP applications. It leverages the power of dynamic driver loading and custom behaviors to provide a highly adaptable solution for application configuration.","archived":false,"fork":false,"pushed_at":"2025-03-16T00:43:39.000Z","size":24,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-04-16T11:08:50.692Z","etag":null,"topics":["commonphp","configuration","configuration-files","configuration-management"],"latest_commit_sha":null,"homepage":"","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/commonphp.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2024-02-17T03:37:06.000Z","updated_at":"2025-03-16T00:43:16.000Z","dependencies_parsed_at":"2024-02-17T18:44:42.603Z","dependency_job_id":null,"html_url":"https://github.com/commonphp/config","commit_stats":null,"previous_names":["commonphp/config"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/commonphp/config","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/commonphp%2Fconfig","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/commonphp%2Fconfig/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/commonphp%2Fconfig/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/commonphp%2Fconfig/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/commonphp","download_url":"https://codeload.github.com/commonphp/config/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/commonphp%2Fconfig/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279044481,"owners_count":26091813,"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-10-15T02:00:07.814Z","response_time":56,"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":["commonphp","configuration","configuration-files","configuration-management"],"created_at":"2024-11-14T03:26:47.319Z","updated_at":"2025-10-15T03:49:12.821Z","avatar_url":"https://github.com/commonphp.png","language":"PHP","readme":"# comphp/config\n\n## Overview\nThe `comphp/config` library is designed to simplify the management of configuration files in PHP applications. It leverages dynamic driver loading and custom behaviors to provide a highly adaptable solution for application configuration.\n\n## Features\n- **Supports Multiple Formats**: JSON and PHP configurations out of the box.\n- **Modular \u0026 Extensible**: Easily register additional parsers.\n- **Dependency Injection Ready**: Works seamlessly with PSR-11 containers.\n- **Merge Strategies**: Replace, merge, or ignore existing configuration values.\n- **Dot-Notation Access**: Retrieve nested configuration values effortlessly.\n\n## Installation\nInstall via Composer:\n\n```sh\ncomposer require comphp/config\n```\n\n## Usage\n### Initialize ConfigManager\n```php\nuse Neuron\\Configuration\\ConfigManager;\nuse DI\\ContainerBuilder;\n\n$container = (new ContainerBuilder())-\u003ebuild();\n$configManager = new ConfigManager($container);\n```\n\n### Load Configuration Files\n```php\n$configManager-\u003eload('database', 'config.json');\n$configManager-\u003eload('app', 'config.php');\n```\n\n### Access Configuration Values\n```php\necho $configManager-\u003eget('database.host', 'default_host');\n```\n\n### Modify Configuration\n```php\n$configManager-\u003eset('cache.enabled', true);\n$configManager-\u003eunset('cache.enabled');\n```\n\n### Convert Configuration to Array\n```php\nprint_r($configManager-\u003etoArray());\n```\n\n## Supported Formats\nBy default, `comphp/config` supports:\n- JSON (`.json`)\n- PHP (`.php` returning an array)\n\nYou can register additional parsers using `ParserRegistry`.\n\n## Extending with Custom Parsers\n```php\nuse Neuron\\Configuration\\Parsers\\JsonParser;\nuse Neuron\\Configuration\\ParserRegistry;\n\n$parserRegistry = $configManager-\u003eparsers;\n$parserRegistry-\u003eregister(YamlParser::class, 'yaml');\n$parserRegistry-\u003eregister(DatabaseParser::class, 'db')\n```\n\n## Merge Strategies\nWhen loading configurations, you can define how new values are merged:\n- `MergeMode::Replace` (default): Overwrites existing values.\n- `MergeMode::Merge`: Merges arrays recursively.\n- `MergeMode::Ignore`: Keeps existing values untouched.\n- `MergeMode::Error`: Throws an exception if a key already exists.\n\nExample:\n```php\nuse Neuron\\Configuration\\MergeMode;\n$configManager-\u003eload('app', 'config.json', MergeMode::Merge);\n```\n\n## License\nThis project is licensed under the MIT License - see the [LICENSE](license.md) file for details.\n\n## Contributing\nSee [CONTRIBUTING.md](contributing.md) for guidelines on how to contribute.\n\n## Changelog\nSee [CHANGELOG.md](changelog.md) for a history of updates.\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcommonphp%2Fconfig","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcommonphp%2Fconfig","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcommonphp%2Fconfig/lists"}