{"id":26490355,"url":"https://github.com/jaxon-php/jaxon-config","last_synced_at":"2025-03-20T07:57:56.767Z","repository":{"id":272360139,"uuid":"916318447","full_name":"jaxon-php/jaxon-config","owner":"jaxon-php","description":"Save config options in immutable objects","archived":false,"fork":false,"pushed_at":"2025-03-03T00:27:39.000Z","size":14,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-03T01:26:52.970Z","etag":null,"topics":["config","immutable","options"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jaxon-php.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,"publiccode":null,"codemeta":null}},"created_at":"2025-01-13T21:36:52.000Z","updated_at":"2025-03-03T00:27:42.000Z","dependencies_parsed_at":"2025-03-03T01:22:27.896Z","dependency_job_id":"e76b9d77-133d-4165-8a92-181b2bbc55b2","html_url":"https://github.com/jaxon-php/jaxon-config","commit_stats":null,"previous_names":["jaxon-php/jaxon-config"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaxon-php%2Fjaxon-config","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaxon-php%2Fjaxon-config/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaxon-php%2Fjaxon-config/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaxon-php%2Fjaxon-config/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jaxon-php","download_url":"https://codeload.github.com/jaxon-php/jaxon-config/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244574732,"owners_count":20474818,"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","immutable","options"],"created_at":"2025-03-20T07:57:56.243Z","updated_at":"2025-03-20T07:57:56.762Z","avatar_url":"https://github.com/jaxon-php.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build Status](https://github.com/jaxon-php/jaxon-config/actions/workflows/test.yml/badge.svg?branch=main)](https://github.com/jaxon-php/jaxon-config/actions)\n[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/jaxon-php/jaxon-config/badges/quality-score.png?b=main)](https://scrutinizer-ci.com/g/jaxon-php/jaxon-config/?branch=main)\n[![StyleCI](https://styleci.io/repos/916318447/shield?branch=main)](https://styleci.io/repos/916318447)\n[![codecov](https://codecov.io/gh/jaxon-php/jaxon-config/graph/badge.svg?token=tgRCemFota)](https://codecov.io/gh/jaxon-php/jaxon-config)\n\n[![Latest Stable Version](https://poser.pugx.org/jaxon-php/jaxon-config/v/stable)](https://packagist.org/packages/jaxon-php/jaxon-config)\n[![Total Downloads](https://poser.pugx.org/jaxon-php/jaxon-config/downloads)](https://packagist.org/packages/jaxon-php/jaxon-config)\n[![License](https://poser.pugx.org/jaxon-php/jaxon-config/license)](https://packagist.org/packages/jaxon-php/jaxon-config)\n\nJaxon Config\n============\n\nJaxon Config saves config options in immutable objects.\n\n**Install**\n\n```bash\ncomposer require jaxon-php/jaxon-config\n```\n\n**Usage**\n\nCreate a config setter.\n\n```php\n$setter = new \\Jaxon\\Config\\ConfigSetter();\n```\n\nCreate a config object with initial value.\n\n```php\n/** @var \\Jaxon\\Config\\Config */\n$config = $setter-\u003enewConfig([\n    'a' =\u003e [\n        'b' =\u003e [\n            'c' =\u003e 'Value',\n        ],\n    ],\n]);\n```\n\nCreate a config reader.\n\n```php\n$reader = new \\Jaxon\\Config\\ConfigReader($setter);\n```\n\nRead config options from a file.\n\n```php\n// A new config object is returned.\n// From a PHP file.\n$config = $reader-\u003eload($config, '/path/to/config/file.php');\n// Or from a YAML file.\n$config = $reader-\u003eload($config, '/path/to/config/file.yaml');\n// Or from a JSON file.\n$config = $reader-\u003eload($config, '/path/to/config/file.json');\n```\n\nCreate an empty config object and set values.\n\n```php\n/** @var \\Jaxon\\Config\\Config */\n$config = $setter-\u003enewConfig();\n// A new config object is returned.\n$config = $setter-\u003esetOptions($config, [\n    'a' =\u003e [\n        'b' =\u003e [\n            'c' =\u003e 'Value',\n        ],\n    ],\n]);\n```\n\nRead values.\n\n```php\n$config-\u003egetOption('a'); // Returns ['b' =\u003e ['c' =\u003e 'Value']]\n$config-\u003egetOption('a.b'); // Returns ['c' =\u003e 'Value']\n$config-\u003egetOption('a.b.c'); // Returns 'Value'\n```\n\nSet a single value.\n\n```php\n// A new config object is returned.\n$config = $setter-\u003esetOption($config, 'a.b.d', 'Another value');\n```\n\nRead values.\n\n```php\n$config-\u003egetOption('a'); // Returns ['b' =\u003e ['c' =\u003e 'Value', 'd' =\u003e 'Another value']]\n$config-\u003egetOption('a.b'); // Returns ['c' =\u003e 'Value', 'd' =\u003e 'Another value']\n$config-\u003egetOption('a.b.c'); // Returns 'Value'\n$config-\u003egetOption('a.b.d'); // Returns 'Another value'\n```\n\nSet values with a prefix.\n\n```php\n// A new config object is returned.\n$config = $setter-\u003esetOptions($config, [\n    'd' =\u003e [\n        'e' =\u003e 'Overwritten value',\n    ],\n    'f' =\u003e ['Array', 'Of', 'Values'],\n], 'a.b');\n```\n\nRead values.\n\n```php\n$config-\u003egetOption('a.b'); // Returns ['c' =\u003e 'Value', 'd' =\u003e ['e' =\u003e 'Overwritten value']]\n$config-\u003egetOption('a.b.d'); // Returns ['e' =\u003e 'Overwritten value']\n$config-\u003egetOption('a.b.d.e'); // Returns 'Overwritten value'\n$config-\u003egetOption('a.b.f'); // Returns ['Array', 'Of', 'Values']\n```\n\nCreate a new config object.\n\n```php\n/** @var \\Jaxon\\Config\\Config */\n$config = $setter-\u003enewConfig([\n    'b' =\u003e [\n        'c' =\u003e 'Value',\n    ],\n    'd' =\u003e 'Value',\n    'e' =\u003e 'Value',\n    'f' =\u003e 'Value',\n], 'a');\n```\n\nRead values.\n\n```php\n$config-\u003egetOption('a'); // Returns ['b' =\u003e ['c' =\u003e 'Value'], 'd' =\u003e 'Value', 'e' =\u003e 'Value', 'f' =\u003e 'Value']\n```\n\nRemove an entry.\n\n```php\n// A new config object is returned.\n$config = $setter-\u003eunsetOption($config, 'a.e');\n```\n\nRead values.\n\n```php\n$config-\u003egetOption('a'); // Returns ['b' =\u003e ['c' =\u003e 'Value'], 'd' =\u003e 'Value', 'f' =\u003e 'Value']\n```\n\nRemove multiple entries.\n\n```php\n// A new config object is returned.\n$config = $setter-\u003eunsetOptions($config, ['a.f', 'a.b']);\n```\n\nRead values.\n\n```php\n$config-\u003egetOption('a'); // Returns ['d' =\u003e 'Value']\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjaxon-php%2Fjaxon-config","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjaxon-php%2Fjaxon-config","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjaxon-php%2Fjaxon-config/lists"}