{"id":22382973,"url":"https://github.com/fey/php-oop-project-lvl1","last_synced_at":"2025-06-24T13:05:22.581Z","repository":{"id":117282654,"uuid":"334199056","full_name":"fey/php-oop-project-lvl1","owner":"fey","description":"Data validator is a library that can be used to check the correctness of any data.","archived":false,"fork":false,"pushed_at":"2021-03-04T05:05:27.000Z","size":31,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-01T01:52:16.623Z","etag":null,"topics":["data-validator","hexlet","oop","php","validator"],"latest_commit_sha":null,"homepage":"https://ru.hexlet.io/programs/php-oop/projects/60","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fey.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2021-01-29T16:22:13.000Z","updated_at":"2021-03-04T05:05:29.000Z","dependencies_parsed_at":null,"dependency_job_id":"feefc5cb-bf5b-4311-a61f-0973f2d7cf33","html_url":"https://github.com/fey/php-oop-project-lvl1","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fey%2Fphp-oop-project-lvl1","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fey%2Fphp-oop-project-lvl1/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fey%2Fphp-oop-project-lvl1/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fey%2Fphp-oop-project-lvl1/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fey","download_url":"https://codeload.github.com/fey/php-oop-project-lvl1/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245727640,"owners_count":20662553,"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":["data-validator","hexlet","oop","php","validator"],"created_at":"2024-12-05T00:42:32.335Z","updated_at":"2025-03-26T19:44:28.317Z","avatar_url":"https://github.com/fey.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"### Hexlet tests and linter status:\n[![Actions Status](https://github.com/fey/php-oop-project-lvl1/workflows/hexlet-check/badge.svg)](https://github.com/fey/php-oop-project-lvl1/actions)\n[![Maintainability](https://api.codeclimate.com/v1/badges/fc3be5da2d90a7701ac9/maintainability)](https://codeclimate.com/github/fey/php-oop-project-lvl1/maintainability)\n[![Test Coverage](https://api.codeclimate.com/v1/badges/fc3be5da2d90a7701ac9/test_coverage)](https://codeclimate.com/github/fey/php-oop-project-lvl1/test_coverage)\n\n### Description\nData validator is a library that can be used to check the correctness of any data.\n\n### Prequesites\n\n* PHP \u003e=7.4\n* Composer\n\n### Commands\n```shell\n$ make start\n$ make test\n```\n\n### Usage\n\n```php\n\u003c?php\n\nuse Hexlet\\Validator\\Validator;\n\n$v = new \\Hexlet\\Validator\\Validator();\n\n// строки\n$schema = $v-\u003erequired()-\u003estring();\n\n$schema-\u003eisValid('what does the fox say'); // true\n$schema-\u003eisValid(''); // false\n\n// числа\n$schema = $v-\u003erequired()-\u003enumber()-\u003epositive();\n\n$schema-\u003eisValid(-10); // false\n$schema-\u003eisValid(10); // true\n\n// массив с поддержкой проверки структуры\n$schema = $v-\u003earray()-\u003esizeof(2)-\u003eshape([\n    'name' =\u003e $v-\u003estring()-\u003erequired(),\n    'age' =\u003e $v-\u003enumber()-\u003epositive(),\n]);\n\n$schema-\u003eisValid(['name' =\u003e 'kolya', 'age' =\u003e 100]); // true\n$schema-\u003eisValid(['name' =\u003e '', 'age' =\u003e null]); // false\n\n// Добавление нового валидатора\n$fn = fn($value, $start) =\u003e str_starts_with($value, $start);\n$v-\u003eaddValidator('string', 'startWith', $fn);\n\n$schema = $v-\u003estring()-\u003etest('startWith', 'H');\n\n$schema-\u003eisValid('exlet'); // false\n$schema-\u003eisValid('Hexlet'); // true\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffey%2Fphp-oop-project-lvl1","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffey%2Fphp-oop-project-lvl1","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffey%2Fphp-oop-project-lvl1/lists"}