{"id":22051357,"url":"https://github.com/jamesgober/config","last_synced_at":"2026-02-08T12:31:39.416Z","repository":{"id":264038457,"uuid":"892163098","full_name":"jamesgober/Config","owner":"jamesgober","description":"Advanced PHP configuration management designed for flexibility and performance, with built-in support for JSON, YAML, XML, INI, and limitless custom formats.","archived":false,"fork":false,"pushed_at":"2024-12-06T13:18:33.000Z","size":240,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-14T11:52:00.092Z","etag":null,"topics":["config","configuration","configuration-management","extensible","ini-parser","json-parser","php","xml-parser","yaml-parser"],"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/jamesgober.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":".github/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":".github/SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-11-21T16:06:15.000Z","updated_at":"2025-01-19T20:28:49.000Z","dependencies_parsed_at":"2025-05-09T02:23:42.506Z","dependency_job_id":"252c5b6f-ef1b-425d-a764-b8c47fe237c5","html_url":"https://github.com/jamesgober/Config","commit_stats":null,"previous_names":["jamesgober/config"],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/jamesgober/Config","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jamesgober%2FConfig","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jamesgober%2FConfig/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jamesgober%2FConfig/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jamesgober%2FConfig/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jamesgober","download_url":"https://codeload.github.com/jamesgober/Config/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jamesgober%2FConfig/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268531912,"owners_count":24265250,"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-03T02:00:12.545Z","response_time":2577,"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-management","extensible","ini-parser","json-parser","php","xml-parser","yaml-parser"],"created_at":"2024-11-30T15:08:43.153Z","updated_at":"2026-02-08T12:31:39.391Z","avatar_url":"https://github.com/jamesgober.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003e\n    \u003cpicture\u003e\n        \u003csource media=\"(prefers-color-scheme: dark)\" srcset=\"./docs/media/jamesgober-logo-dark.png\"\u003e\n        \u003cimg width=\"72\" height=\"72\" alt=\"Official brand mark and logo of James Gober. Image shows JG stylish initials encased in a hexagon outline.\" src=\"./docs/media/jamesgober-logo.png\"\u003e\n    \u003c/picture\u003e\n    \u003cbr\u003e\n    \u003cb\u003eCONFIG MANAGER\u003c/b\u003e\n    \u003cbr\u003e\n    \u003csup\u003eBY JAMES GOBER\u003c/sup\u003e\n    \u003cbr\u003e\n\u003c/h1\u003e\n\n\u003cdiv align=\"center\"\u003e\n    \u003cimg src=\"https://img.shields.io/github/stars/jamesgober/config?style=flat\" alt=\"GitHub Stars\"\u003e \u0026nbsp; \n    \u003cimg src=\"https://img.shields.io/github/issues/jamesgober/config?style=flat\" alt=\"GitHub Issues\"\u003e \u0026nbsp;  \n    \u003cimg src=\"https://img.shields.io/github/v/release/jamesgober/config?display_name=tag\u0026style=flat\" alt=\"GitHub Release\"\u003e \u0026nbsp; \n    \u003cimg src=\"https://img.shields.io/github/license/jamesgober/config?style=flat\" alt=\"GitHub License\"\u003e \u0026nbsp;\n    \u003cimg src=\"https://img.shields.io/badge/PHP-8.2-blue?style=flat\" alt=\"PHP Version\"\u003e \u0026nbsp;\n    \u003ca href=\"https://packagist.org/packages/jamesgober/config\" target=\"_blank\"\u003e\n        \u003cimg alt=\"Packagist Downloads\" src=\"https://img.shields.io/packagist/dt/jamesgober/config?style=flat\u0026color=%23f26f1a\"\u003e\n    \u003c/a\u003e\n\u003c/div\u003e\n\n\u0026nbsp;\n\n\u003ch2\u003eA Flexible PHP Configuration Manager\u003c/h2\u003e\n\nConfig is a lightweight yet powerful PHP library designed to handle your application's configuration needs with ease and efficiency. Supporting multiple formats like **JSON**, **XML**, **YAML**, **INI**, and **PHP** arrays out of the box, it provides the flexibility to add custom parsers tailored to your specific requirements. With robust error handling, performance-focused design, and a modular architecture, **JG\\Config** simplifies configuration management for modern PHP projects.\n\n\u0026nbsp;\n\n## Key Features\n\n- **Multi-Format Support**: Seamlessly load configurations from **JSON**, **XML**, **YAML**, **INI**, **PHP**, and **CONF** files.\n- **Custom Parsers**: Extend functionality by adding support for any file format with ease.\n- **Performance Optimizations**: Designed for speed, even with large or deeply nested configurations.\n- **Advanced Features**: Includes caching, dynamic flattening control, and stream parsing for modern workflows.\n- **Robust Error Handling**: Custom exceptions provide clear and actionable feedback for debugging.\n- **Lightweight and Intuitive**: A simple yet powerful API designed for minimal overhead and ease of use.\n\n\u0026nbsp;\n\n## Why Choose This Library?\n\n**JG\\Config** is built for developers who demand efficiency, reliability, and flexibility in their projects:\n\n- **High Performance**: Optimized for speed with low overhead, making it ideal for high-load scenarios.\n- **Modular Design**: Extend or replace parsers effortlessly to meet custom needs.\n- **Error-Resilient**: Provides comprehensive error handling with meaningful exception messages.\n- **Extensively Tested**: Rigorously tested with PHPUnit for predictable and stable performance.\n- **Built on Principles**: Adheres to S.O.L.I.D design principles and emphasizes maintainability and extensibility.\n\nWhether you're building a small application or managing a large-scale project, **JG\\Config** provides a robust solution to streamline your configuration management.\n\n\u0026nbsp;\n\n---\n\n\u0026nbsp;\n\n\n## Installation\n\nInstall via [composer](https://getcomposer.org/download/):\n\n```bash\n$ composer require jamesgober/config\n```\n\u0026nbsp;\n\n\u0026nbsp;\n\n\n## Quick Start\n\n#### Load Configurations\nEffortlessly load multiple configuration files in various formats:\n```php\nuse JG\\Config\\Config;\n\n$config = new Config('/path/to/config/files');\n\n// Load files\n$config-\u003eload('database.json');\n$config-\u003eload('app.xml');\n\n// Access values\n$dbHost = $config-\u003eget('database.host', 'default_host');\n\n// Check keys\nif ($config-\u003ehas('app.debug')) {\n    echo \"Debug mode is enabled!\";\n}\n\n// Add or update values\n$config-\u003eadd('app.name', 'MyApp');\n```\n\n\u0026nbsp;\n\n#### Manage Configurations\nEasily delete individual values or entire groups:\n```php\n// Delete specific values\n$config-\u003edelete('app.version'); // Removes app.version\n\n// Delete groups\n$config-\u003edelete('app'); // Removes app.name, app.debug, etc.\n```\n\n\u0026nbsp;\n\n#### Extend with Custom Parsers\nAdd support for new file formats via custom parsers:\n```php\nuse JG\\Config\\ConfigParserFactory;\n\n// Register a parser for .custom files\nConfigParserFactory::registerParser('custom', MyCustomParser::class);\n```\n\n---\n\n\u0026nbsp;\n\n## Supported Formats\n\n| **Format** | **Example**       | **Extension** |\n|------------|-------------------|----------------|\n| CONF       | `config.conf`     | `.conf`        |\n| INI        | `config.ini`      | `.ini`         |\n| JSON       | `config.json`     | `.json`        |\n| PHP Array  | `config.php`      | `.php`         |\n| XML        | `config.xml`      | `.xml`         |\n| YAML       | `config.yaml`     | `.yaml`, `.yml`|\n\n\u0026nbsp;\n\nFor more examples, see our **[Advanced Usage](docs/ADVANCED.md)** guide.\n\n\u0026nbsp;\n\n---\n\n## Error Handling\n\n### Custom Exceptions\n\nJG\\Config uses custom exceptions for intuitive error handling:\n\n| **Exception**                           | **Description**                                |\n|-----------------------------------------|------------------------------------------------|\n| `ConfigException`                       | General errors related to configuration.       |\n| `ConfigParseException`                  | Errors when parsing configuration files.       |\n| `InvalidParserException`                | When unsupported or invalid parsers are used.  |\n\n\u0026nbsp;\n\n**Example Usage:**\n```php\nuse JG\\Config\\Exceptions\\ConfigException;\n\ntry {\n    $config-\u003eload('missing_file.json');\n} catch (ConfigException $e) {\n    echo \"Error: \" . $e-\u003egetMessage();\n}\n```\n\n---\n\n\u0026nbsp;\n\n## Advanced Features\n\nExplore advanced capabilities like caching, custom parsers, and dynamic flattening in our **[Advanced Guide](docs/ADVANCED.md)**.\n\n\u0026nbsp;\n\n---\n\n## Directory Structure\n\n```\nsrc/\n├── Config.php                  # Core configuration management class\n├── ConfigParserFactory.php     # Factory for parser resolution\n├── Exceptions/                 # Custom exceptions for robust error handling\n│   ├── ConfigException.php\n│   ├── ConfigParseException.php\n│   └── InvalidParserException.php\n├── Parsers/                    # Built-in parsers for supported formats\n│   ├── ParserInterface.php\n│   ├── PhpParser.php\n│   ├── JsonParser.php\n│   ├── IniParser.php\n│   ├── XmlParser.php\n│   └── YamlParser.php\ntests/                          # Unit and integration tests\n```\n\n---\n\n\u0026nbsp;\n\n## Reporting Security Issues\n\nWe take security seriously. If you find a vulnerability, please consult our **[SECURITY POLICY](.github/SECURITY.md)** and follow the instructions for reporting. \n\nDo not use public issue trackers or forums to disclose sensitive information.\n\n\u0026nbsp;\n\n---\n\n## Reporting Bugs and Feature Requests\n\nFor non-security issues, such as bugs or feature requests, please use our **[Issue Tracker](https://github.com/jamesgober/Config/issues)**. Providing detailed information will help us resolve issues efficiently.\n\n\u0026nbsp;\n\n---\n\n## Design Philosophy\n\nLearn about the principles that guide the development of **JG\\Config** in our **[Design Philosophy](docs/DESIGN_PHILOSOPHY.md)**.\n\n\u0026nbsp;\n\n---\n\n## Contributing\n\nContributions are welcome! Check out the **[Contribution Guidelines](.github/CONTRIBUTING.md)** and review our **[Code of Conduct](.github/CODE_OF_CONDUCT.md)** for more information.\n\n\u0026nbsp;\n\n---\n\n## License\n\nThis library is open-source software licensed under the [MIT license](LICENSE).\n\n\u0026nbsp;\n\n\u0026nbsp;\n\n\u003cdiv align=\"center\"\u003e\n    \u003ca href=\"#top\"\u003e\u0026uarr;\u003cbr\u003e TOP \u003c/a\u003e \n\u003c/div\u003e\n\n\u003c!-- \n# COPYRIGHT\n######################################################### --\u003e\n\u003ch2\u003e\u003c/h2\u003e\n\u003cp align=\"center\"\u003e\n    \u003csmall\u003eCOPYRIGHT \u0026copy; 2024 JAMES GOBER \u0026amp; JAMESGOBER.COM.\u003c/small\u003e\n\u003c/p\u003e\n\n\u0026nbsp;\n\n\n\u003c!-- \n# LINKS\n######################################################### --\u003e\n[Contribution Guidelines]: .github/CONTRIBUTING.md\n[CONTRIBUTING]:            .github/CONTRIBUTING.md\n[CODE OF CONDUCT]:         .github/CODE_OF_CONDUCT.md\n[REPORT SECURITY ISSUES]:  .github/SECURITY.md\n[SECURITY POLICY]:         .github/SECURITY.md\n[SECURITY]:                .github/SECURITY.md","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjamesgober%2Fconfig","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjamesgober%2Fconfig","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjamesgober%2Fconfig/lists"}