{"id":27192106,"url":"https://github.com/xentixar/validator","last_synced_at":"2026-04-25T12:36:48.061Z","repository":{"id":252817280,"uuid":"841582137","full_name":"xentixar/validator","owner":"xentixar","description":"Validator is a PHP validation library that provides a robust mechanism for validating data based on various rules. It includes a command-line tool for publishing configuration files and a Validator class for data validation.","archived":false,"fork":false,"pushed_at":"2024-08-12T18:30:58.000Z","size":9,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-17T14:29:35.909Z","etag":null,"topics":["data-validation","data-validation-and-error-handling","data-validator","form-validation","php","php-validation","validation"],"latest_commit_sha":null,"homepage":"https://packagist.org/packages/xentixar/validator","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/xentixar.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":"2024-08-12T17:36:05.000Z","updated_at":"2024-08-12T18:30:01.000Z","dependencies_parsed_at":"2024-08-12T19:06:21.083Z","dependency_job_id":null,"html_url":"https://github.com/xentixar/validator","commit_stats":null,"previous_names":["xentixar/validator"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/xentixar/validator","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xentixar%2Fvalidator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xentixar%2Fvalidator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xentixar%2Fvalidator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xentixar%2Fvalidator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xentixar","download_url":"https://codeload.github.com/xentixar/validator/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xentixar%2Fvalidator/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32262801,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-25T09:15:33.318Z","status":"ssl_error","status_checked_at":"2026-04-25T09:15:31.997Z","response_time":59,"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":["data-validation","data-validation-and-error-handling","data-validator","form-validation","php","php-validation","validation"],"created_at":"2025-04-09T18:36:03.178Z","updated_at":"2026-04-25T12:36:48.042Z","avatar_url":"https://github.com/xentixar.png","language":"PHP","readme":"# Xentixar Validator\n\nXentixar Validator is a PHP validation library that provides a robust mechanism for validating data based on various rules. It includes a command-line tool for publishing configuration files and a `Validator` class for data validation.\n\n## Features\n\n- Data validation with rules like required, email, min, max, unique, and more.\n- Customizable error messages.\n- Integration with a PDO-based database for unique and existence checks.\n- Command-line utility for managing configuration files.\n\n## Installation\n\n```sh\ncomposer require xentixar/validator\n```\n\n## Configuration\n\nBefore using the validator, you'll need to set up configuration files.\n\n### Publishing Configuration Files\n\nRun the following command to publish the default configuration files to your project:\n\n```sh\ncd vendor/xentixar/validator/bin\nphp xentixar publish:config\n```\n\nThis command will copy the configuration files to `config/vendor/validator`:\n\n- `database.php` for database connection settings.\n- `messages.php` for custom validation messages.\n\n### Configuration Files\n\n#### `config/vendor/validator/database.php`\n\nProvide your database connection settings here. Example:\n\n```php\n\u003c?php\n\nreturn [\n    'driver' =\u003e 'mysql',\n    'host' =\u003e '127.0.0.1',\n    'port' =\u003e '3306',\n    'database' =\u003e 'your_database',\n    'username' =\u003e 'your_username',\n    'password' =\u003e 'your_password',\n    'charset' =\u003e 'utf8mb4',\n    'collation' =\u003e 'utf8mb4_unicode_ci',\n    'prefix' =\u003e '',\n];\n```\n\n#### `config/vendor/validator/messages.php`\n\nDefine custom error messages for validation rules. Example:\n\n```php\n\u003c?php\n\nreturn [\n    'required' =\u003e 'The :field field is required.',\n    'email' =\u003e 'The :field field must be a valid email address.',\n    'min' =\u003e 'The :field field must be at least :param characters.',\n    'max' =\u003e 'The :field field must not exceed :param characters.',\n    'between' =\u003e 'The :field field must be between :min and :max characters.',\n    'numeric' =\u003e 'The :field field must be a number.',\n    'integer' =\u003e 'The :field field must be an integer.',\n    'url' =\u003e 'The :field field must be a valid URL.',\n    'date' =\u003e 'The :field field must be a valid date (Y-m-d).',\n    'confirmed' =\u003e 'The :field confirmation does not match.',\n    'same' =\u003e 'The :field field must match the :param field.',\n    'unique' =\u003e 'The :field field must be unique.',\n    'exists' =\u003e 'The :field field does not exist.',\n    'in' =\u003e 'The :field field must be one of the following values: :values.',\n    'regex' =\u003e 'The :field field format is invalid.',\n    'size' =\u003e 'The :field field must be exactly :param characters.',\n    'date_format' =\u003e 'The :field field does not match the format :param.',\n    'file' =\u003e 'The :field field must be a valid uploaded file.',\n    'mimes' =\u003e 'The :field field must be a file of type: :types.',\n];\n```\n\n## Usage\n\n### Basic Validation\n\nHere's a quick example of how to use the `Validator` class:\n\n```php\nuse Xentixar\\Validator\\Validator;\n\n$validator = new Validator();\n\n$data = [\n    'email' =\u003e 'example@domain.com',\n    'password' =\u003e 'password123',\n];\n\n$rules = [\n    'email' =\u003e 'required|email',\n    'password' =\u003e 'required|min:6',\n];\n\nif ($validator-\u003evalidate($data, $rules)) {\n    echo \"Validation passed!\";\n} else {\n    print_r($validator-\u003eerrors());\n}\n```\n\n### Error Messages\n\nYou can customize error messages in the `messages.php` configuration file. The validator will use these messages if a rule fails.\n\n## Command-Line Utility\n\n### Available Commands\n\n- `publish:config`: Copies the default configuration files to the `config/vendor/validator` directory.\n\n### Running Commands\n\nTo run a command, use:\n\n```sh\nphp xentixar [command]\n```\n\nFor example:\n\n```sh\nphp xentixar publish:config\n```\n\n## Contributing\n\nContributions are welcome! Please follow these steps:\n\n1. Fork the repository.\n2. Create a feature branch (`git checkout -b feature/YourFeature`).\n3. Commit your changes (`git commit -am 'Add new feature'`).\n4. Push to the branch (`git push origin feature/YourFeature`).\n5. Create a new Pull Request.\n\n## License\n\nThis package is licensed under the [MIT License](LICENSE).\n\n## Contact\n\nFor questions or support, please open an issue on [GitHub](https://github.com/xentixar/validator/issues).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxentixar%2Fvalidator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxentixar%2Fvalidator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxentixar%2Fvalidator/lists"}