{"id":15029423,"url":"https://github.com/acgrid/config.php","last_synced_at":"2026-02-03T01:37:01.429Z","repository":{"id":56939994,"uuid":"150252228","full_name":"acgrid/config.php","owner":"acgrid","description":"PHP configuration manager","archived":false,"fork":false,"pushed_at":"2018-10-12T15:56:54.000Z","size":16,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-28T02:02:47.757Z","etag":null,"topics":["apcu","configuration-management","php-library","php72"],"latest_commit_sha":null,"homepage":null,"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/acgrid.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}},"created_at":"2018-09-25T11:09:04.000Z","updated_at":"2021-09-12T01:50:50.000Z","dependencies_parsed_at":"2022-08-21T01:40:21.651Z","dependency_job_id":null,"html_url":"https://github.com/acgrid/config.php","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/acgrid/config.php","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/acgrid%2Fconfig.php","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/acgrid%2Fconfig.php/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/acgrid%2Fconfig.php/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/acgrid%2Fconfig.php/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/acgrid","download_url":"https://codeload.github.com/acgrid/config.php/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/acgrid%2Fconfig.php/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29026398,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-03T00:53:18.321Z","status":"ssl_error","status_checked_at":"2026-02-03T00:51:45.186Z","response_time":58,"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":["apcu","configuration-management","php-library","php72"],"created_at":"2024-09-24T20:10:37.868Z","updated_at":"2026-02-03T01:37:01.413Z","avatar_url":"https://github.com/acgrid.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Config.php\n## Features\n* Collection for configuration items\n* Deferred item definition, item is never defined until it is used\n* Self-descriptive, with IDE auto-completion powered\n* Deferred resolution of current and default value \n* Enumeration and export for administrative script and manager\n* Full control for populating pre-loaded data\n* Caching via PHP's ultra-fast APCu with write-back on demand\n* Shipped with some helpers for quick reader and writer\n\n## Usage\n\n### Definition\nExtend `Collection` with each definition a public function\n\nAn Live Template of PHPStorm like this can be added to make a shortcut\n```php\npublic function $CONF_NAME$(): Item\n{\n    return $this-\u003emake(__FUNCTION__, $DEF_VALUE$, $READER$, $WRITER$);\n}\n```\n### Source\nInstantiate your own `Loader` with a callback that return the array of raw data of configuration. The key shall be the Collection's FQN. Just `require` the dumped file in case of using a saved php configuration file. Call `setApcu('key_prefix')` to enable APCu caching.\n\n### Routines\nInstantiate needed children instance of `Collection`, which a DI container is suggested to fulfil the task. Pass the loader in previous step. Then you call get the configuration by `$collection-\u003eitem()()`. Note that `__invoke()` is used. Otherwise what you get is a `Item` object having many useful methods like `def()` and `raw()`.\n\nSee tests for more detailed usage.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Facgrid%2Fconfig.php","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Facgrid%2Fconfig.php","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Facgrid%2Fconfig.php/lists"}