{"id":19197584,"url":"https://github.com/awurth/slimvalidation","last_synced_at":"2025-04-06T16:12:58.787Z","repository":{"id":14126407,"uuid":"76068297","full_name":"awurth/SlimValidation","owner":"awurth","description":"A wrapper around the Respect Validation PHP validation library for easier error handling and display","archived":false,"fork":false,"pushed_at":"2023-12-18T12:53:13.000Z","size":190,"stargazers_count":68,"open_issues_count":2,"forks_count":23,"subscribers_count":5,"default_branch":"5.x","last_synced_at":"2024-10-24T18:04:58.213Z","etag":null,"topics":["php","respect","slim","twig-extension","validation","validator"],"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/awurth.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2016-12-09T20:31:39.000Z","updated_at":"2024-10-14T12:39:04.000Z","dependencies_parsed_at":"2024-06-18T13:45:47.407Z","dependency_job_id":null,"html_url":"https://github.com/awurth/SlimValidation","commit_stats":{"total_commits":203,"total_committers":9,"mean_commits":"22.555555555555557","dds":"0.40886699507389157","last_synced_commit":"9cd345355b376f9b7dc211eaf9f6660c87e7015e"},"previous_names":[],"tags_count":26,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/awurth%2FSlimValidation","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/awurth%2FSlimValidation/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/awurth%2FSlimValidation/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/awurth%2FSlimValidation/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/awurth","download_url":"https://codeload.github.com/awurth/SlimValidation/tar.gz/refs/heads/5.x","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247509236,"owners_count":20950232,"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":["php","respect","slim","twig-extension","validation","validator"],"created_at":"2024-11-09T12:17:24.785Z","updated_at":"2025-04-06T16:12:58.751Z","avatar_url":"https://github.com/awurth.png","language":"PHP","readme":"# Slim Validation\n\n[![CI](https://github.com/awurth/SlimValidation/actions/workflows/ci.yml/badge.svg)](https://github.com/awurth/SlimValidation/actions/workflows/ci.yml)\n[![Latest Stable Version](https://poser.pugx.org/awurth/slim-validation/v/stable)](https://packagist.org/packages/awurth/slim-validation)\n[![License](https://poser.pugx.org/awurth/slim-validation/license)](https://packagist.org/packages/awurth/slim-validation)\n\n[![Total Downloads](https://poser.pugx.org/awurth/slim-validation/downloads)](https://packagist.org/packages/awurth/slim-validation)\n[![Monthly Downloads](http://poser.pugx.org/awurth/slim-validation/d/monthly)](https://packagist.org/packages/awurth/slim-validation)\n\nA wrapper around the [Respect Validation](https://github.com/Respect/Validation) PHP validation library for easier error handling and display\n\n\u003e This project was originally designed to be used with the Micro-Framework \"Slim\", hence the name \"Slim Validation\", but can now\n  be used in any other PHP project.\n\n## Installation\n\n``` bash\n$ composer require awurth/slim-validation\n```\n\n## Documentation\n\n* [**5.x**](https://github.com/awurth/SlimValidation/tree/5.x/docs) (current, PHP \u003e= 8.1) \n* [**3.4**](https://github.com/awurth/SlimValidation/tree/3.x/docs) (outdated, PHP \u003e= 7.1)\n\n## Usage\n\nThe following example shows how to validate that a string is at least 10 characters long:\n\n``` php\nuse Awurth\\Validator\\Validator;\nuse Respect\\Validation\\Validator as V;\n\n$validator = Validator::create();\n$failures = $validator-\u003evalidate('Too short', V::notBlank()-\u003elength(min: 10));\n\nif (0 !== $failures-\u003ecount()) {\n    // Validation failed: display errors\n    foreach ($failures as $failure) {\n        echo $failure-\u003egetMessage();\n    }\n}\n```\n\nThe `validate()` method returns a list of validation failures as an object that implements [`ValidationFailureCollectionInterface`](src/ValidationFailureCollectionInterface.php). If you have lots of validation failures, you can filter them with a callback:\n\n``` php\nuse Awurth\\Validator\\ValidationFailureInterface;\n\n$failures = $validator-\u003evalidate(/* ... */);\n$filteredFailures = $failures-\u003efilter(static function (ValidationFailureInterface $failure, int $index): bool {\n    return $failure-\u003egetRuleName() === 'notBlank';\n});\n```\n\n## License\n\nThis package is available under the [MIT license](LICENSE).\n\n\u003ca href=\"https://www.buymeacoffee.com/awurth\" target=\"_blank\"\u003e\u003cimg src=\"https://cdn.buymeacoffee.com/buttons/v2/default-green.png\" alt=\"Buy Me A Coffee\" style=\"height: 60px !important;width: 217px !important;\" \u003e\u003c/a\u003e\n","funding_links":["https://www.buymeacoffee.com/awurth"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fawurth%2Fslimvalidation","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fawurth%2Fslimvalidation","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fawurth%2Fslimvalidation/lists"}