{"id":20672793,"url":"https://github.com/selective-php/array-reader","last_synced_at":"2026-03-07T12:07:15.069Z","repository":{"id":45403297,"uuid":"216211282","full_name":"selective-php/array-reader","owner":"selective-php","description":"A strictly typed array reader for PHP","archived":false,"fork":false,"pushed_at":"2025-05-28T16:10:48.000Z","size":41,"stargazers_count":11,"open_issues_count":0,"forks_count":5,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-11-06T08:14:58.885Z","etag":null,"topics":["array","array-reader","php","strictly-typed"],"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/selective-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":"2019-10-19T13:31:56.000Z","updated_at":"2025-05-28T16:07:33.000Z","dependencies_parsed_at":"2024-06-19T01:25:55.037Z","dependency_job_id":"1c5425b0-3368-470c-95b5-7fa39786d7cb","html_url":"https://github.com/selective-php/array-reader","commit_stats":{"total_commits":38,"total_committers":3,"mean_commits":"12.666666666666666","dds":0.3157894736842105,"last_synced_commit":"3233c5409da33009514d276c4ecf74d151c9a7d4"},"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/selective-php/array-reader","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/selective-php%2Farray-reader","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/selective-php%2Farray-reader/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/selective-php%2Farray-reader/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/selective-php%2Farray-reader/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/selective-php","download_url":"https://codeload.github.com/selective-php/array-reader/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/selective-php%2Farray-reader/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30212506,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-07T09:02:10.694Z","status":"ssl_error","status_checked_at":"2026-03-07T09:02:08.429Z","response_time":53,"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":["array","array-reader","php","strictly-typed"],"created_at":"2024-11-16T20:38:50.021Z","updated_at":"2026-03-07T12:07:15.035Z","avatar_url":"https://github.com/selective-php.png","language":"PHP","readme":"# selective/array-reader\n\nA strictly typed array reader for PHP.\n\n[![Latest Version on Packagist](https://img.shields.io/github/release/selective-php/array-reader.svg)](https://packagist.org/packages/selective/array-reader)\n[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg)](LICENSE)\n[![Build Status](https://github.com/selective-php/array-reader/workflows/build/badge.svg)](https://github.com/selective-php/array-reader/actions)\n[![Total Downloads](https://img.shields.io/packagist/dt/selective/array-reader.svg)](https://packagist.org/packages/selective/array-reader/stats)\n\n## Requirements\n\n* PHP 8.1 - 8.4\n\n## Installation\n\n```bash\ncomposer require selective/array-reader\n```\n\n## Usage\n\nYou can use the `ArrayReader` to read single values from a multidimensional \narray by passing the path to one of the `get{type}()` and `find{type}()` methods. \n\nEach `get*() / find*()` method takes a default value as second argument.\nIf the path cannot be found in the original array, the default is used as return value.\n\nA `get*()` method returns only the declared return type. \nIf the default value is not given and the element cannot be found, an exception is thrown.\n\nA `find*()` method returns only the declared return type or `null`. \nNo exception is thrown if the element cannot be found.\n\n```php\n\u003c?php\n\nuse Selective\\ArrayReader\\ArrayReader;\n\n$arrayReader = new ArrayReader([\n    'key1' =\u003e [\n        'key2' =\u003e [\n            'key3' =\u003e 'value1',\n        ]\n    ]\n]);\n\n// Output: value1\necho $arrayReader-\u003egetString('key1.key2.key3');\n```\n\n## Better Code Quality\n\nConverting complex data with simple PHP works by using a lot of type casting and `if` conditions etc.\nThis leads to very high cyclomatic complexity and nesting depth, and thus poor \"code rating\".\n\n**Before**: Conditions: 10, Paths: 512, CRAP Score: 10\n\u003cdetails\u003e\n  \u003csummary\u003eClick to expand!\u003c/summary\u003e\n\u003cimg src=\"https://user-images.githubusercontent.com/781074/109776592-096fcc80-7c03-11eb-95d4-6eef8fe982e2.png\"\u003e\n\u003c/details\u003e\n\n**After**: Conditions: 1, Paths: 1, CRAP Score: 1\n\u003cdetails\u003e\n  \u003csummary\u003eClick to expand!\u003c/summary\u003e\n\u003cimg src=\"https://user-images.githubusercontent.com/781074/109777526-1e992b00-7c04-11eb-8e6b-04d538661f4a.png\"\u003e\n\u003c/details\u003e\n\n## Similar libraries\n\n* https://github.com/michaelpetri/typed-input\n* https://github.com/codeliner/array-reader\n* https://github.com/adbario/php-dot-notation\n* https://symfony.com/doc/current/components/property_access.html\n\n## License\n\nThe MIT License (MIT). Please see [License File](LICENSE) for more information.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fselective-php%2Farray-reader","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fselective-php%2Farray-reader","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fselective-php%2Farray-reader/lists"}