{"id":20763384,"url":"https://github.com/dentelis/php-json-structure-validator","last_synced_at":"2025-08-19T10:11:53.561Z","repository":{"id":221027926,"uuid":"694029306","full_name":"dentelis/php-json-structure-validator","owner":"dentelis","description":"Lightweight library to validate/assert json documents structure","archived":false,"fork":false,"pushed_at":"2024-05-22T17:19:05.000Z","size":178,"stargazers_count":18,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-30T07:49:49.547Z","etag":null,"topics":["assert","assertions","json","php8","structure","testing","validate","validation"],"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/dentelis.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","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":"2023-09-20T07:32:53.000Z","updated_at":"2025-04-11T05:13:23.000Z","dependencies_parsed_at":"2024-02-20T18:47:07.560Z","dependency_job_id":"3035e0c8-9f71-4df0-bf15-1a1611217d0c","html_url":"https://github.com/dentelis/php-json-structure-validator","commit_stats":null,"previous_names":["dentelis/validator","dentelis/php-structure-validator","dentelis/php-json-structure-validator"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dentelis%2Fphp-json-structure-validator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dentelis%2Fphp-json-structure-validator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dentelis%2Fphp-json-structure-validator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dentelis%2Fphp-json-structure-validator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dentelis","download_url":"https://codeload.github.com/dentelis/php-json-structure-validator/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251666226,"owners_count":21624290,"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":["assert","assertions","json","php8","structure","testing","validate","validation"],"created_at":"2024-11-17T10:43:57.900Z","updated_at":"2025-04-30T07:49:53.604Z","avatar_url":"https://github.com/dentelis.png","language":"PHP","readme":"# dentelis/php-json-structure-validator\n\nValidator is a lightweight PHP library for validating the structure of data retrieved from an external json API.\n\nThe library was originally created for use in acceptance api tests, but can be used anywhere else as well.\n\n## Specific\n\nThe library was made to test json compatible data structures. Array key validation is not supported.\n\n## Installation\n\nUse the package manager [composer](https://getcomposer.org/) to install.\n\n```bash\ncomposer require dentelis/php-json-structure-validator\n```\n\n## Usage\n\nYou can use library with(or without) any testing framework you want.\n\nSee [dentelis/phpunit-json-assert](https://github.com/dentelis/phpunit-json-assert) for PhpUnit support.\n\n```php\n//object example\n$user = (new ObjectType())\n    -\u003eaddProperty('name', (new StringType())-\u003eassertNotEmpty())\n    -\u003eaddProperty('email', (new StringType())-\u003eassertEmail());\n    \n$data = json_decode('{\"name\":\"user\", \"email\":\"user@example.com\"}');\ntry {\n    $user-\u003evalidate($data);\n} catch (ValidationException $e) {\n    //do smth\n    \n}\n\n//array of objects\n$users = (new ArrayType())\n    -\u003eassertNotEmpty()\n    -\u003eassertType($user);\n\n$data = json_decode('[{\"name\":\"user\", \"email\":\"user@example.com\"},{\"name\":\"user\", \"email\":\"user@example.com\"}]');\ntry {\n    $users-\u003evalidate($data);\n} catch (ValidationException $e) {\n    //do smth\n\n}\n\n\n```\n\nSee [examples](https://github.com/dentelis/validator/tree/master/examples) directory for full example.\n\n## Todo\n\n- [ ] more examples\n- [ ] proper path in exceptions\n- [ ] do not fail on first exception\n- [ ] comments translate to english\n- [ ] create TypeInterface from Classname (what to do with arrays)\n\n## Contributing\n\nPull requests are welcome. For major changes, please open an issue first\nto discuss what you would like to change.\n\nPlease make sure to update tests as appropriate.\n\n## License\n\n[MIT](https://choosealicense.com/licenses/mit/)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdentelis%2Fphp-json-structure-validator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdentelis%2Fphp-json-structure-validator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdentelis%2Fphp-json-structure-validator/lists"}