{"id":18273230,"url":"https://github.com/spacetab-io/configuration-php","last_synced_at":"2026-02-09T17:02:11.074Z","repository":{"id":57056335,"uuid":"253299688","full_name":"spacetab-io/configuration-php","owner":"spacetab-io","description":"Configuration module for microservices written on PHP. Specially created for follow up corporate standards of application configuration.","archived":false,"fork":false,"pushed_at":"2022-04-11T14:29:09.000Z","size":68,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-11-27T16:34:09.268Z","etag":null,"topics":["configuration","microservice","php","standard","yaml"],"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/spacetab-io.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-04-05T18:06:22.000Z","updated_at":"2022-04-11T13:22:08.000Z","dependencies_parsed_at":"2022-08-24T07:30:22.780Z","dependency_job_id":null,"html_url":"https://github.com/spacetab-io/configuration-php","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"purl":"pkg:github/spacetab-io/configuration-php","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spacetab-io%2Fconfiguration-php","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spacetab-io%2Fconfiguration-php/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spacetab-io%2Fconfiguration-php/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spacetab-io%2Fconfiguration-php/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/spacetab-io","download_url":"https://codeload.github.com/spacetab-io/configuration-php/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spacetab-io%2Fconfiguration-php/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29273139,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-09T13:47:44.167Z","status":"ssl_error","status_checked_at":"2026-02-09T13:47:43.721Z","response_time":56,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["configuration","microservice","php","standard","yaml"],"created_at":"2024-11-05T12:05:42.086Z","updated_at":"2026-02-09T17:02:06.064Z","avatar_url":"https://github.com/spacetab-io.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"PHP Configuration\n-----------------\n\n[![CircleCI](https://circleci.com/gh/spacetab-io/configuration-php/tree/master.svg?style=svg)](https://circleci.com/gh/spacetab-io/configuration-php/tree/master)\n[![codecov](https://codecov.io/gh/spacetab-io/configuration-php/branch/master/graph/badge.svg)](https://codecov.io/gh/spacetab-io/configuration-php)\n\nConfiguration module for PHP that supports multiple application stages like `dev`, `prod` or `something else` \nand overrides the `defaults` stage.\n\n## Installation\n\n```bash\ncomposer require spacetab-io/configuration\n```\n\n#### Versions map\n\n* Package with version `4.*` requires PHP \u003e= `8.1`\n* Package with version `3.*` requires PHP \u003e= `7.4` \u003c= `8.0`\n* Package with version `2.*` requires PHP \u003c `7.4`\n\n## Usage\n\nBy default, path to configuration directory and application stage\nloading from `/app/configuration` with `local` stage.\n\n1) Simple\n```php\n\u003c?php\nuse Spacetab\\Configuration\\Configuration;\n\n$conf = new Configuration();\n$conf-\u003eload();\n\nvar_dump($conf-\u003eall()); // get all config\necho $conf-\u003eget('foo.bar'); // get nested key use dot notation\necho $conf['foo.bar']; // the same, but use ArrayAccess interface.\n```\n\nSupported dot-notation syntax with an asterisk in `get` method. \nYou can read about it here: https://github.com/spacetab-io/obelix-php\n\n2) If u would like override default values, you can pass 2 arguments to\nclass constructor or set up use setters.\n\n```php\n\u003c?php\nuse Spacetab\\Configuration\\Configuration;\n\n$conf = new Configuration(__DIR__ . '/configuration', 'test');\n$conf-\u003eload();\n\n$conf-\u003eget('key'); // full example on the top\n```\n\n3) If the operating system has an env variables `CONFIG_PATH` and `STAGE`,\nthen values for the package will be taken from there.\n\n```bash\nexport CONFIG_PATH=/configuration\nexport STAGE=prod\n```\n\n```php\n\u003c?php\nuse Spacetab\\Configuration\\Configuration;\n\n$conf = new Configuration();\n$conf-\u003eload(); // loaded files from /configuration for prod stage.\n\n$conf-\u003eget('key'); // full example on the top\n```\n\n4) If u want to see logs and see how load process working,\npass you application logger to the following method:\n\n```php\n\u003c?php\nuse Spacetab\\Configuration\\Configuration;\n\n$conf = new Configuration();\n$conf-\u003esetLogger($monolog); // PSR compatible logger.\n$conf-\u003eload();\n\n$conf-\u003eget('key'); // full example on the top\n```\n\nIf you want you can use [this package](https://github.com/spacetab-io/logger-php) for logs:\n\n```bash\ncomposer require spacetab-io/logger\n```\n\nThat all.\n\n## CLI utility\n\nAlso, you can install simple small cli-utility to dump total results of merged config.\nIt is possible with multiple ways:\n\n1) Install to `/usr/local/bin` as global binary\n\n```bash\nL=/usr/local/bin/st-conf \u0026\u0026 sudo curl -L https://github.com/spacetab-io/configuration-php/releases/download/2.2.0/st-conf.phar -o $L \u0026\u0026 sudo chmod +x $L\n```\n\n2) Install library as global composer requirements\n\nFirst step:\n```bash\ncomposer global require spacetab-io/configuration-php\n```\n\nIt will be installed to `~/.composer` directory.\n\nIf you have `~/.composer/vendor/bin` in globals path, you can try run command:\n```bash\nst-conf help dump\n```\n\nOtherwise, you can be register that directory:\n```bash\necho 'export PATH=~/.composer/vendor/bin:$PATH' \u003e\u003e ~/.bash_profile\nsource ~/.bash_profile\n```\n\n### CLI Usage\n\n```bash\nDescription:\n  Dump loaded configuration\n\nUsage:\n  dump [options] [--] [\u003cpath\u003e [\u003cstage\u003e]]\n\nArguments:\n  path                   Configuration directory path\n  stage                  Configuration $STAGE\n\nOptions:\n  -l, --inline[=INLINE]  The level where you switch to inline YAML [default: 10]\n  -s, --indent[=INDENT]  The amount of spaces to use for indentation of nested nodes [default: 2]\n  -d, --debug            Debug\n  -h, --help             Display this help message\n  -q, --quiet            Do not output any message\n  -V, --version          Display this application version\n      --ansi             Force ANSI output\n      --no-ansi          Disable ANSI output\n  -n, --no-interaction   Do not ask any interactive question\n  -v|vv|vvv, --verbose   Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug\n\nHelp:\n  Example of usage: `st-conf dump`. Options --inline=10 (nesting level) and --indent=2. If [path] and [stage] arguments not passed will be used global env variables CONFIG_PATH and STAGE.\n```\n\n## Depends\n\n* \\\u003e= PHP 8.1\n* Composer for install package\n\n## License\n\nThe MIT License\n\nCopyright © 2022 spacetab.io, Inc. https://spacetab.io\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspacetab-io%2Fconfiguration-php","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fspacetab-io%2Fconfiguration-php","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspacetab-io%2Fconfiguration-php/lists"}