{"id":20678887,"url":"https://github.com/phpgt/config","last_synced_at":"2025-04-19T23:45:24.573Z","repository":{"id":4063047,"uuid":"51778650","full_name":"phpgt/Config","owner":"phpgt","description":"Manage configuration with ini files and environment variables.","archived":false,"fork":false,"pushed_at":"2024-07-29T15:11:11.000Z","size":253,"stargazers_count":0,"open_issues_count":10,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-19T23:45:21.018Z","etag":null,"topics":["config","configuration","configuration-file","deployment","environment-variables","ini","phpgt"],"latest_commit_sha":null,"homepage":"https://www.php.gt/config","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/phpgt.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","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},"funding":{"github":["phpgt"]}},"created_at":"2016-02-15T19:10:33.000Z","updated_at":"2024-07-29T15:11:14.000Z","dependencies_parsed_at":"2024-07-29T18:44:45.986Z","dependency_job_id":"faf05fbd-1e23-40a8-9779-e1d804cc886c","html_url":"https://github.com/phpgt/Config","commit_stats":{"total_commits":146,"total_committers":5,"mean_commits":29.2,"dds":"0.36986301369863017","last_synced_commit":"123e291f1edc35e136acd55a995136398585a490"},"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phpgt%2FConfig","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phpgt%2FConfig/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phpgt%2FConfig/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phpgt%2FConfig/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/phpgt","download_url":"https://codeload.github.com/phpgt/Config/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249830845,"owners_count":21331357,"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","configuration","configuration-file","deployment","environment-variables","ini","phpgt"],"created_at":"2024-11-16T21:22:56.013Z","updated_at":"2025-04-19T23:45:24.559Z","avatar_url":"https://github.com/phpgt.png","language":"PHP","funding_links":["https://github.com/sponsors/phpgt"],"categories":[],"sub_categories":[],"readme":"# Manage configuration with ini files and environment variables.\n\nManage your project configuration by defining defaults, that can be overridden by ini files and environment variables.\n\nAlso provides functionality for generating ini files from the CLI.\n\nDocumentation: https://php.gt/docs/config\n\n***\n\n\u003ca href=\"https://github.com/PhpGt/Config/actions\" target=\"_blank\"\u003e\n\t\u003cimg src=\"https://badge.status.php.gt/config-build.svg\" alt=\"Build status\" /\u003e\n\u003c/a\u003e\n\u003ca href=\"https://scrutinizer-ci.com/g/PhpGt/Config\" target=\"_blank\"\u003e\n\t\u003cimg src=\"https://badge.status.php.gt/config-quality.svg\" alt=\"Code quality\" /\u003e\n\u003c/a\u003e\n\u003ca href=\"https://scrutinizer-ci.com/g/PhpGt/Config\" target=\"_blank\"\u003e\n\t\u003cimg src=\"https://badge.status.php.gt/config-coverage.svg\" alt=\"Code coverage\" /\u003e\n\u003c/a\u003e\n\u003ca href=\"https://packagist.org/packages/PhpGt/Config\" target=\"_blank\"\u003e\n\t\u003cimg src=\"https://badge.status.php.gt/config-version.svg\" alt=\"Current version\" /\u003e\n\u003c/a\u003e\n\u003ca href=\"http://www.php.gt/config\" target=\"_blank\"\u003e\n\t\u003cimg src=\"https://badge.status.php.gt/config-docs.svg\" alt=\"PHP.Gt/Config documentation\" /\u003e\n\u003c/a\u003e\n\n## Example usage - loading project configuration:\n\nA project's configuration can be split across multiple files. The following example shows how a secret can be supplied through the environment, which is used to override the default value defined within config.ini, and also shows how other named config files can be used.\n\nnginx.conf:\n\n```\nlocation ~ \\.php$ {\n\tfastcgi_pass\tunix:/var/run/php/php7.1-fpm.sock;\n\tfastcgi_param\tdatabase_password\tsuper-secret-passw0rd;\n\tinclude\t\tfastcgi_params;\n}\n```\n\nconfig.ini:\n\n```ini\n[app]\nnamespace = MyApp\ndebug = true\nlogging = verbose\n\n[database]\nhost = db.example.com\nschema = local_shop\nusername = admin\npassword = admin_pass\n\n[shopapi]\nkey = jungfnyyguvffubhgvat\nsecret = guvfvfnybpnyfubcgurerfabguvatsbelbhurer\n```\n\nconfig.dev.ini:\n\n```ini\n[database]\nhost = localhost\n```\n\nexample.php:\n\n```php\n// Load config.ini\n$config = new Config(\"/path/to/project\");\n\n// Note that the database password is overriden in the environment (from nginx)\n// and the host is overridden by the development ini file.\necho $config-\u003eget(\"database.host\");\t\t// localhost\necho $config-\u003eget(\"database.port\");\t\t// 6612\necho $config-\u003eget(\"database.password\");\t\t// super-secret-passw0rd\n```\n\n## Example usage - generating configuration files:\n\nSometimes it's useful to generate config files on-the-fly, such as from Continuous Integration scripts. Below shows a quick example of how to generate a `config.deploy.ini` file with a few key-values that will override the default.\n\n```\nvendor/bin/config-generate deploy \"shopapi.key=test-api-key\" \"database.schema=local_shop_$BRANCH_NAME\"\n```\n\nThe above command will create a `config.deploy.ini` file (note the first argument of \"deploy\") and provide overrides for two ini keys using dot notation. Note that because this command will be run within a continuous integration setting, we are expecting there to be a $BRANCH_NAME variable set for us, allowing us to use a schema name containing the current branch. ","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphpgt%2Fconfig","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fphpgt%2Fconfig","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphpgt%2Fconfig/lists"}